]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - libs/jpeg6/jinclude.h
some updates to the Linux build system - obtained a core binary and all required...
[xonotic/netradiant.git] / libs / jpeg6 / jinclude.h
1 /*\r
2  * jinclude.h\r
3  *\r
4  * Copyright (C) 1991-1994, Thomas G. Lane.\r
5  * This file is part of the Independent JPEG Group's software.\r
6  * For conditions of distribution and use, see the accompanying README file.\r
7  *\r
8  * This file exists to provide a single place to fix any problems with\r
9  * including the wrong system include files.  (Common problems are taken\r
10  * care of by the standard jconfig symbols, but on really weird systems\r
11  * you may have to edit this file.)\r
12  *\r
13  * NOTE: this file is NOT intended to be included by applications using the\r
14  * JPEG library.  Most applications need only include jpeglib.h.\r
15  */\r
16 \r
17 \r
18 /* Include auto-config file to find out which system include files we need. */\r
19 \r
20 #include "jconfig.h"            /* auto configuration options */\r
21 #define JCONFIG_INCLUDED        /* so that jpeglib.h doesn't do it again */\r
22 \r
23 /*\r
24  * We need the NULL macro and size_t typedef.\r
25  * On an ANSI-conforming system it is sufficient to include <stddef.h>.\r
26  * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to\r
27  * pull in <sys/types.h> as well.\r
28  * Note that the core JPEG library does not require <stdio.h>;\r
29  * only the default error handler and data source/destination modules do.\r
30  * But we must pull it in because of the references to FILE in jpeglib.h.\r
31  * You can remove those references if you want to compile without <stdio.h>.\r
32  */\r
33 \r
34 #ifdef HAVE_STDDEF_H\r
35 #include <stddef.h>\r
36 #endif\r
37 \r
38 #ifdef HAVE_STDLIB_H\r
39 #include <stdlib.h>\r
40 #endif\r
41 \r
42 #ifdef NEED_SYS_TYPES_H\r
43 #include <sys/types.h>\r
44 #endif\r
45 \r
46 #include <stdio.h>\r
47 \r
48 /*\r
49  * We need memory copying and zeroing functions, plus strncpy().\r
50  * ANSI and System V implementations declare these in <string.h>.\r
51  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().\r
52  * Some systems may declare memset and memcpy in <memory.h>.\r
53  *\r
54  * NOTE: we assume the size parameters to these functions are of type size_t.\r
55  * Change the casts in these macros if not!\r
56  */\r
57 \r
58 #ifdef NEED_BSD_STRINGS\r
59 \r
60 #include <strings.h>\r
61 #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))\r
62 #define MEMCOPY(dest,src,size)  bcopy((const void *)(src), (void *)(dest), (size_t)(size))\r
63 \r
64 #else /* not BSD, assume ANSI/SysV string lib */\r
65 \r
66 #include <string.h>\r
67 #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))\r
68 #define MEMCOPY(dest,src,size)  memcpy((void *)(dest), (const void *)(src), (size_t)(size))\r
69 \r
70 #endif\r
71 \r
72 /*\r
73  * In ANSI C, and indeed any rational implementation, size_t is also the\r
74  * type returned by sizeof().  However, it seems there are some irrational\r
75  * implementations out there, in which sizeof() returns an int even though\r
76  * size_t is defined as long or unsigned long.  To ensure consistent results\r
77  * we always use this SIZEOF() macro in place of using sizeof() directly.\r
78  */\r
79 \r
80 #define SIZEOF(object)  ((size_t) sizeof(object))\r
81 \r
82 /*\r
83  * The modules that use fread() and fwrite() always invoke them through\r
84  * these macros.  On some systems you may need to twiddle the argument casts.\r
85  * CAUTION: argument order is different from underlying functions!\r
86  */\r
87 \r
88 #define JFREAD(file,buf,sizeofbuf)  \\r
89   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))\r
90 #define JFWRITE(file,buf,sizeofbuf)  \\r
91   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))\r