1 // qcms 2 // Copyright (C) 2009 Mozilla Foundation 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining 5 // a copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 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 Software 9 // is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 16 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 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 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. 21 22 #ifndef QCMS_TYPES_H 23 #define QCMS_TYPES_H 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 collide */ 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 57 #define IS_LITTLE_ENDIAN 58 #elif BYTE_ORDER == BIG_ENDIAN 59 #define IS_BIG_ENDIAN 60 #endif 61 62 /* all of the platforms that we use _MSC_VER on are little endian 63 * so this is sufficient for now */ 64 #ifdef _MSC_VER 65 #define IS_LITTLE_ENDIAN 66 #endif 67 68 #ifdef __OS2__ 69 #define IS_LITTLE_ENDIAN 70 #endif 71 72 #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN) 73 #error Unknown endianess 74 #endif 75 76 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__) 77 # include <inttypes.h> 78 #elif defined (_MSC_VER) 79 typedef __int8 int8_t; 80 typedef unsigned __int8 uint8_t; 81 typedef __int16 int16_t; 82 typedef unsigned __int16 uint16_t; 83 typedef __int32 int32_t; 84 typedef unsigned __int32 uint32_t; 85 typedef __int64 int64_t; 86 typedef unsigned __int64 uint64_t; 87 #ifdef _WIN64 88 typedef unsigned __int64 uintptr_t; 89 #else 90 #pragma warning(push) 91 /* Disable benign redefinition of type warning 4142 */ 92 #pragma warning(disable:4142) 93 typedef unsigned long uintptr_t; 94 /* Restore warnings */ 95 #pragma warning(pop) 96 #endif 97 98 #elif defined (_AIX) 99 # include <sys/inttypes.h> 100 #else 101 # include <stdint.h> 102 #endif 103 104 #endif 105 106 typedef qcms_bool bool; 107 #define true 1 108 #define false 0 109 110 #endif 111