qcmstypes.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #ifndef QCMS_TYPES_H
  22. #define QCMS_TYPES_H
  23. #ifdef MOZ_QCMS
  24. #include "prtypes.h"
  25. /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */
  26. #if defined (__SVR4) && defined (__sun)
  27. /* int_types.h gets included somehow, so avoid redefining the types differently */
  28. #include <sys/int_types.h>
  29. #elif defined (_AIX)
  30. #include <sys/types.h>
  31. #elif !defined(ANDROID)
  32. typedef PRInt8 int8_t;
  33. typedef PRUint8 uint8_t;
  34. typedef PRInt16 int16_t;
  35. typedef PRUint16 uint16_t;
  36. typedef PRInt32 int32_t;
  37. typedef PRUint32 uint32_t;
  38. typedef PRInt64 int64_t;
  39. typedef PRUint64 uint64_t;
  40. #ifdef __OS2__
  41. /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
  42. #include <stdlib.h>
  43. #elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
  44. typedef PRUptrdiff uintptr_t;
  45. #endif
  46. #endif
  47. #else // MOZ_QCMS
  48. #if BYTE_ORDER == LITTLE_ENDIAN
  49. #define IS_LITTLE_ENDIAN
  50. #elif BYTE_ORDER == BIG_ENDIAN
  51. #define IS_BIG_ENDIAN
  52. #endif
  53. /* all of the platforms that we use _MSC_VER on are little endian
  54. * so this is sufficient for now */
  55. #ifdef _MSC_VER
  56. #define IS_LITTLE_ENDIAN
  57. #endif
  58. #ifdef __OS2__
  59. #define IS_LITTLE_ENDIAN
  60. #endif
  61. #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN)
  62. #error Unknown endianess
  63. #endif
  64. #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__)
  65. # include <inttypes.h>
  66. #elif defined (_MSC_VER)
  67. typedef __int8 int8_t;
  68. typedef unsigned __int8 uint8_t;
  69. typedef __int16 int16_t;
  70. typedef unsigned __int16 uint16_t;
  71. typedef __int32 int32_t;
  72. typedef unsigned __int32 uint32_t;
  73. typedef __int64 int64_t;
  74. typedef unsigned __int64 uint64_t;
  75. #ifdef _WIN64
  76. typedef unsigned __int64 uintptr_t;
  77. #else
  78. typedef unsigned long uintptr_t;
  79. #endif
  80. #elif defined (_AIX)
  81. # include <sys/inttypes.h>
  82. #else
  83. # include <stdint.h>
  84. #endif
  85. #endif
  86. typedef qcms_bool bool;
  87. #define true 1
  88. #define false 0
  89. #endif