Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

jinclude.h

Go to the documentation of this file.
00001 /*
00002  * jinclude.h
00003  *
00004  * Copyright (C) 1991-1994, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file exists to provide a single place to fix any problems with
00009  * including the wrong system include files.  (Common problems are taken
00010  * care of by the standard jconfig symbols, but on really weird systems
00011  * you may have to edit this file.)
00012  *
00013  * NOTE: this file is NOT intended to be included by applications using the
00014  * JPEG library.  Most applications need only include jpeglib.h.
00015  */
00016 
00017 
00018 #ifdef _WIN32
00019 
00020 #pragma warning(disable : 4018)     // signed/unsigned mismatch
00021 #pragma warning(disable : 4032)
00022 #pragma warning(disable : 4051)
00023 #pragma warning(disable : 4057)     // slightly different base types
00024 #pragma warning(disable : 4100)     // unreferenced formal parameter
00025 #pragma warning(disable : 4115)
00026 #pragma warning(disable : 4125)     // decimal digit terminates octal escape sequence
00027 #pragma warning(disable : 4127)     // conditional expression is constant
00028 #pragma warning(disable : 4136)
00029 #pragma warning(disable : 4152)     // nonstandard extension, function/data pointer conversion in expression
00030 #pragma warning(disable : 4201)
00031 #pragma warning(disable : 4214)
00032 #pragma warning(disable : 4244)
00033 #pragma warning(disable : 4305)     // truncation from const double to float
00034 #pragma warning(disable : 4310)     // cast truncates constant value
00035 #pragma warning(disable:  4505)     // unreferenced local function has been removed
00036 #pragma warning(disable : 4514)
00037 #pragma warning(disable : 4702)     // unreachable code
00038 #pragma warning(disable : 4711)     // selected for automatic inline expansion
00039 #pragma warning(disable : 4220)     // varargs matches remaining parameters
00040 #pragma warning(disable : 4761)     // integral size mismatch 
00041 #endif
00042 
00043 /* Include auto-config file to find out which system include files we need. */
00044 
00045 #include "../jpeg-6/jconfig.h"      /* auto configuration options */
00046 #define JCONFIG_INCLUDED    /* so that jpeglib.h doesn't do it again */
00047 
00048 /*
00049  * We need the NULL macro and size_t typedef.
00050  * On an ANSI-conforming system it is sufficient to include <stddef.h>.
00051  * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
00052  * pull in <sys/types.h> as well.
00053  * Note that the core JPEG library does not require <stdio.h>;
00054  * only the default error handler and data source/destination modules do.
00055  * But we must pull it in because of the references to FILE in jpeglib.h.
00056  * You can remove those references if you want to compile without <stdio.h>.
00057  */
00058 
00059 #ifdef HAVE_STDDEF_H
00060 #include <stddef.h>
00061 #endif
00062 
00063 #ifdef HAVE_STDLIB_H
00064 #include <stdlib.h>
00065 #endif
00066 
00067 #ifdef NEED_SYS_TYPES_H
00068 #include <sys/types.h>
00069 #endif
00070 
00071 #include <stdio.h>
00072 
00073 /*
00074  * We need memory copying and zeroing functions, plus strncpy().
00075  * ANSI and System V implementations declare these in <string.h>.
00076  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
00077  * Some systems may declare memset and memcpy in <memory.h>.
00078  *
00079  * NOTE: we assume the size parameters to these functions are of type size_t.
00080  * Change the casts in these macros if not!
00081  */
00082 
00083 #ifdef NEED_BSD_STRINGS
00084 
00085 #include <strings.h>
00086 #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
00087 #define MEMCOPY(dest,src,size)  bcopy((const void *)(src), (void *)(dest), (size_t)(size))
00088 
00089 #else /* not BSD, assume ANSI/SysV string lib */
00090 
00091 #include <string.h>
00092 #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
00093 #define MEMCOPY(dest,src,size)  memcpy((void *)(dest), (const void *)(src), (size_t)(size))
00094 
00095 #endif
00096 
00097 /*
00098  * In ANSI C, and indeed any rational implementation, size_t is also the
00099  * type returned by sizeof().  However, it seems there are some irrational
00100  * implementations out there, in which sizeof() returns an int even though
00101  * size_t is defined as long or unsigned long.  To ensure consistent results
00102  * we always use this SIZEOF() macro in place of using sizeof() directly.
00103  */
00104 
00105 #define SIZEOF(object)  ((size_t) sizeof(object))
00106 
00107 /*
00108  * The modules that use fread() and fwrite() always invoke them through
00109  * these macros.  On some systems you may need to twiddle the argument casts.
00110  * CAUTION: argument order is different from underlying functions!
00111  */
00112 
00113 #define JFREAD(file,buf,sizeofbuf)  \
00114   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
00115 #define JFWRITE(file,buf,sizeofbuf)  \
00116   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))

Generated on Thu Aug 25 12:37:36 2005 for Quake III Arena by  doxygen 1.3.9.1