OLD | NEW |
1 // qcms | 1 // qcms |
2 // Copyright (C) 2009 Mozilla Foundation | 2 // Copyright (C) 2009 Mozilla Foundation |
3 // | 3 // |
4 // Permission is hereby granted, free of charge, to any person obtaining | 4 // Permission is hereby granted, free of charge, to any person obtaining |
5 // a copy of this software and associated documentation files (the "Software"), | 5 // a copy of this software and associated documentation files (the "Software"), |
6 // to deal in the Software without restriction, including without limitation | 6 // to deal in the Software without restriction, including without limitation |
7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 8 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
9 // is furnished to do so, subject to the following conditions: | 9 // is furnished to do so, subject to the following conditions: |
10 // | 10 // |
11 // The above copyright notice and this permission notice shall be included in | 11 // The above copyright notice and this permission notice shall be included in |
12 // all copies or substantial portions of the Software. | 12 // all copies or substantial portions of the Software. |
13 // | 13 // |
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | 15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
16 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 16 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
21 | 21 |
22 #ifndef QCMS_TYPES_H | 22 #ifndef QCMS_TYPES_H |
23 #define QCMS_TYPES_H | 23 #define QCMS_TYPES_H |
24 | 24 |
25 #ifdef MOZ_QCMS | |
26 | |
27 #include "prtypes.h" | |
28 | |
29 /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */ | |
30 | |
31 #if defined (__SVR4) && defined (__sun) | |
32 /* int_types.h gets included somehow, so avoid redefining the types differently
*/ | |
33 #include <sys/int_types.h> | |
34 #elif defined (_AIX) | |
35 #include <sys/types.h> | |
36 #elif !defined(ANDROID) && !defined(__OpenBSD__) | |
37 typedef PRInt8 int8_t; | |
38 typedef PRUint8 uint8_t; | |
39 typedef PRInt16 int16_t; | |
40 typedef PRUint16 uint16_t; | |
41 typedef PRInt32 int32_t; | |
42 typedef PRUint32 uint32_t; | |
43 typedef PRInt64 int64_t; | |
44 typedef PRUint64 uint64_t; | |
45 | |
46 #ifdef __OS2__ | |
47 /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't colli
de */ | |
48 #include <stdlib.h> | |
49 #elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED) | |
50 typedef PRUptrdiff uintptr_t; | |
51 #endif | |
52 #endif | |
53 | |
54 #else // MOZ_QCMS | |
55 | |
56 #if BYTE_ORDER == LITTLE_ENDIAN | 25 #if BYTE_ORDER == LITTLE_ENDIAN |
57 #define IS_LITTLE_ENDIAN | 26 #define IS_LITTLE_ENDIAN |
58 #elif BYTE_ORDER == BIG_ENDIAN | 27 #elif BYTE_ORDER == BIG_ENDIAN |
59 #define IS_BIG_ENDIAN | 28 #define IS_BIG_ENDIAN |
60 #endif | 29 #endif |
61 | 30 |
62 /* all of the platforms that we use _MSC_VER on are little endian | 31 /* all of the platforms that we use _MSC_VER on are little endian |
63 * so this is sufficient for now */ | 32 * so this is sufficient for now */ |
64 #ifdef _MSC_VER | 33 #ifdef _MSC_VER |
65 #define IS_LITTLE_ENDIAN | 34 #define IS_LITTLE_ENDIAN |
66 #endif | 35 #endif |
67 | 36 |
68 #ifdef __OS2__ | 37 #ifdef __OS2__ |
69 #define IS_LITTLE_ENDIAN | 38 #define IS_LITTLE_ENDIAN |
70 #endif | 39 #endif |
71 | 40 |
72 #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) | 41 #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) |
73 #error Unknown endianess | 42 #error Unknown endianess |
74 #endif | 43 #endif |
75 | 44 |
76 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi)
|| defined (__sun) || defined (sun) || defined (__digital__) | 45 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi)
|| defined (__sun) || defined (sun) || defined (__digital__) |
77 # include <inttypes.h> | 46 # include <inttypes.h> |
78 #elif defined (_MSC_VER) | 47 #elif defined (_MSC_VER) && _MSC_VER < 1600 |
79 typedef __int8 int8_t; | 48 typedef __int8 int8_t; |
80 typedef unsigned __int8 uint8_t; | 49 typedef unsigned __int8 uint8_t; |
81 typedef __int16 int16_t; | 50 typedef __int16 int16_t; |
82 typedef unsigned __int16 uint16_t; | 51 typedef unsigned __int16 uint16_t; |
83 typedef __int32 int32_t; | 52 typedef __int32 int32_t; |
84 typedef unsigned __int32 uint32_t; | 53 typedef unsigned __int32 uint32_t; |
85 typedef __int64 int64_t; | 54 typedef __int64 int64_t; |
86 typedef unsigned __int64 uint64_t; | 55 typedef unsigned __int64 uint64_t; |
87 #ifdef _WIN64 | 56 #ifdef _WIN64 |
88 typedef unsigned __int64 uintptr_t; | 57 typedef unsigned __int64 uintptr_t; |
89 #else | 58 #else |
90 #pragma warning(push) | 59 #pragma warning(push) |
91 /* Disable benign redefinition of type warning 4142 */ | 60 /* Disable benign redefinition of type warning 4142 */ |
92 #pragma warning(disable:4142) | 61 #pragma warning(disable:4142) |
93 typedef unsigned long uintptr_t; | 62 typedef unsigned long uintptr_t; |
94 /* Restore warnings */ | 63 /* Restore warnings */ |
95 #pragma warning(pop) | 64 #pragma warning(pop) |
96 #endif | 65 #endif |
97 | 66 |
98 #elif defined (_AIX) | 67 #elif defined (_AIX) |
99 # include <sys/inttypes.h> | 68 # include <sys/inttypes.h> |
100 #else | 69 #else |
101 # include <stdint.h> | 70 # include <stdint.h> |
102 #endif | 71 #endif |
103 | 72 |
104 #endif | |
105 | |
106 typedef qcms_bool bool; | 73 typedef qcms_bool bool; |
107 #define true 1 | 74 #define true 1 |
108 #define false 0 | 75 #define false 0 |
109 | 76 |
110 #endif | 77 #endif |
OLD | NEW |