Bug 556405 - Support building qcms on Android, r=jrmuizel
authorMichael Wu <mwu@mozilla.com>
Mon, 05 Apr 2010 17:38:43 -0700
changeset 40460 481e63c694af3dd088032bb190b8521dffeddc96
parent 40459 e3c21e4b1d7d61825f519b8b8c61b0e0fa731f5e
child 40461 ac526bc2af65da8548f66dab57b15787ce8c2a02
push id12613
push usermwu@mozilla.com
push dateTue, 06 Apr 2010 00:39:14 +0000
treeherdermozilla-central@481e63c694af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs556405
milestone1.9.3a4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 556405 - Support building qcms on Android, r=jrmuizel
gfx/qcms/iccread.c
gfx/qcms/qcmstypes.h
--- a/gfx/qcms/iccread.c
+++ b/gfx/qcms/iccread.c
@@ -20,45 +20,44 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include <math.h>
 #include <assert.h>
 #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);
 	//return __builtin_bswap32(v);
 	return v;
 #endif
 }
 #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);
 	//return __builtin_bswap32(v);
 #else
 	return 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);
 #else
 	return v;
 #endif
 }
 
@@ -82,30 +81,30 @@ static uint32_t read_u32(struct mem_sour
 {
 	/* Subtract from mem->size instead of the more intuitive adding to offset.
 	 * This avoids overflowing offset. The subtraction is safe because
 	 * mem->size is guaranteed to be > 4 */
 	if (offset > mem->size - 4) {
 		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);
 	}
 }
 
 static uint16_t read_u16(struct mem_source *mem, size_t offset)
 {
 	if (offset > mem->size - 2) {
 		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);
 	}
 }
 
 static uint8_t read_u8(struct mem_source *mem, size_t offset)
 {
 	if (offset > mem->size - 1) {
 		invalid_source(mem, "Invalid offset");
@@ -776,31 +775,31 @@ void qcms_profile_release(qcms_profile *
 }
 
 #include <stdio.h>
 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);
 	length = be32_to_cpu(length_be);
 	if (length > MAX_PROFILE_SIZE)
 		return BAD_VALUE_PROFILE;
 
 	/* allocate room for the entire profile */
 	data = malloc(length);
 	if (!data)
 		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 */
 	read_length = fread((unsigned char*)data + sizeof(length_be), 1, remaining_length, file);
 	if (read_length != remaining_length) {
 		free(data);
 		return INVALID_PROFILE;
 	}
--- a/gfx/qcms/qcmstypes.h
+++ b/gfx/qcms/qcmstypes.h
@@ -7,17 +7,17 @@
 
 /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */
 
 #if defined (__SVR4) && defined (__sun)
 /* int_types.h gets included somehow, so avoid redefining the types differently */
 #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;
 typedef PRUint16 uint16_t;
 typedef PRInt32 int32_t;
 typedef PRUint32 uint32_t;
 typedef PRInt64 int64_t;
 typedef PRUint64 uint64_t;