diff options
author | Michael Wu <mwu@mozilla.com> | 2010-05-06 12:16:38 -0400 |
---|---|---|
committer | Jeff Muizelaar <jmuizelaar@mozilla.com> | 2010-05-06 12:16:38 -0400 |
commit | d0c963e1d0c1a840bb96d32e91319b319e0bda38 (patch) | |
tree | 5348a21c73d0581b3eb7b06e000750acd6bdc614 | |
parent | dae0a1c2e652be551cb4e258484ae9c05c549435 (diff) |
Support building qcms on Android
Bug 556405. Use be32 and be16 instead __be32 and __be16 as the underscore versions can
conflict with system types.
-rw-r--r-- | iccread.c | 23 | ||||
-rw-r--r-- | qcmstypes.h | 2 |
2 files changed, 12 insertions, 13 deletions
@@ -25,15 +25,14 @@ #include <stdlib.h> #include "qcmsint.h" -//XXX: use a better typename -typedef uint32_t __be32; -typedef uint16_t __be16; +typedef uint32_t be32; +typedef uint16_t be16; #if 0 not used yet /* __builtin_bswap isn't available in older gccs * so open code it for now */ -static __be32 cpu_to_be32(int32_t v) +static be32 cpu_to_be32(int32_t v) { #ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); @@ -43,7 +42,7 @@ static __be32 cpu_to_be32(int32_t v) } #endif -static uint32_t be32_to_cpu(__be32 v) +static uint32_t be32_to_cpu(be32 v) { #ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | ((v & 0xff000000) >> 24); @@ -53,7 +52,7 @@ static uint32_t be32_to_cpu(__be32 v) #endif } -static uint32_t be16_to_cpu(__be16 v) +static uint16_t be16_to_cpu(be16 v) { #ifdef IS_LITTLE_ENDIAN return ((v & 0xff) << 8) | ((v & 0xff00) >> 8); @@ -87,8 +86,8 @@ static uint32_t read_u32(struct mem_source *mem, size_t offset) invalid_source(mem, "Invalid offset"); return 0; } else { - __be32 k; - memcpy(&k, mem->buf + offset, sizeof(__be32)); + be32 k; + memcpy(&k, mem->buf + offset, sizeof(k)); return be32_to_cpu(k); } } @@ -99,8 +98,8 @@ static uint16_t read_u16(struct mem_source *mem, size_t offset) invalid_source(mem, "Invalid offset"); return 0; } else { - __be16 k; - memcpy(&k, mem->buf + offset, sizeof(__be16)); + be16 k; + memcpy(&k, mem->buf + offset, sizeof(k)); return be16_to_cpu(k); } } @@ -781,7 +780,7 @@ qcms_profile* qcms_profile_from_file(FILE *file) uint32_t length, remaining_length; qcms_profile *profile; size_t read_length; - __be32 length_be; + be32 length_be; void *data; fread(&length_be, sizeof(length), 1, file); @@ -795,7 +794,7 @@ qcms_profile* qcms_profile_from_file(FILE *file) return NO_MEM_PROFILE; /* copy in length to the front so that the buffer will contain the entire profile */ - *((__be32*)data) = length_be; + *((be32*)data) = length_be; remaining_length = length - sizeof(length_be); /* read the rest profile */ diff --git a/qcmstypes.h b/qcmstypes.h index 6394f90..26c138a 100644 --- a/qcmstypes.h +++ b/qcmstypes.h @@ -12,7 +12,7 @@ #include <sys/int_types.h> #elif defined (_AIX) #include <sys/types.h> -#else +#elif !defined(ANDROID) typedef PRInt8 int8_t; typedef PRUint8 uint8_t; typedef PRInt16 int16_t; |