Bug 491195 fix warnings in qcms
authortimeless@mozdev.org
Wed, 22 Jul 2009 17:31:03 -0500
changeset 30578 29669195ef9784f6d7e11c47f0f67dab9e7e77b8
parent 30577 975b1965bb8c5d21746e263a21d73171001f6c91
child 30579 cfdb650315aad12d9f2d041e02c100b9ec80887c
push id8141
push userdb48x@yahoo.com
push dateWed, 22 Jul 2009 22:33:25 +0000
treeherdermozilla-central@2956e5255fc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs491195
milestone1.9.2a1pre
Bug 491195 fix warnings in qcms mostly comparisons between unsigned and signed also an incomplete initializer and a warning about using C++ style variables r=jrmuizel
gfx/qcms/iccread.c
gfx/qcms/transform.c
--- a/gfx/qcms/iccread.c
+++ b/gfx/qcms/iccread.c
@@ -195,17 +195,17 @@ struct tag
 struct tag_index {
 	uint32_t count;
 	struct tag *tags;
 };
 
 static struct tag_index read_tag_table(qcms_profile *profile, struct mem_source *mem)
 {
 	struct tag_index index = {0, NULL};
-	int i;
+	unsigned int i;
 
 	index.count = read_u32(mem, 128);
 	if (index.count > MAX_TAG_COUNT) {
 		invalid_source(mem, "max number of tags exceeded");
 		return index;
 	}
 
 	index.tags = malloc(sizeof(struct tag)*index.count);
@@ -292,34 +292,34 @@ qcms_bool qcms_profile_is_bogus(qcms_pro
 #define TAG_rTRC 0x72545243
 #define TAG_bTRC 0x62545243
 #define TAG_gTRC 0x67545243
 #define TAG_kTRC 0x6b545243
 #define TAG_A2B0 0x41324230
 
 static struct tag *find_tag(struct tag_index index, uint32_t tag_id)
 {
-	int i;
+	unsigned int i;
 	struct tag *tag = NULL;
 	for (i = 0; i < index.count; i++) {
 		if (index.tags[i].signature == tag_id) {
 			return &index.tags[i];
 		}
 	}
 	return tag;
 }
 
 #define XYZ_TYPE   0x58595a20 // 'XYZ '
 #define CURVE_TYPE 0x63757276 // 'curv'
 #define LUT16_TYPE 0x6d667432 // 'mft2'
 #define LUT8_TYPE  0x6d667431 // 'mft1'
 
 static struct XYZNumber read_tag_XYZType(struct mem_source *src, struct tag_index index, uint32_t tag_id)
 {
-	struct XYZNumber num = {0};
+	struct XYZNumber num = {0, 0, 0};
 	struct tag *tag = find_tag(index, tag_id);
 	if (tag) {
 		uint32_t offset = tag->offset;
 
 		uint32_t type = read_u32(src, offset);
 		if (type != XYZ_TYPE)
 			invalid_source(src, "unexpected type, expected XYZ");
 		num.X = read_s15Fixed16Number(src, offset+8);
@@ -334,17 +334,17 @@ static struct XYZNumber read_tag_XYZType
 static struct curveType *read_tag_curveType(struct mem_source *src, struct tag_index index, uint32_t tag_id)
 {
 	struct tag *tag = find_tag(index, tag_id);
 	struct curveType *curve = NULL;
 	if (tag) {
 		uint32_t offset = tag->offset;
 		uint32_t type = read_u32(src, offset);
 		uint32_t count = read_u32(src, offset+8);
-		int i;
+		unsigned int i;
 
 		if (type != CURVE_TYPE) {
 			invalid_source(src, "unexpected type, expected CURV");
 			return NULL;
 		}
 
 #define MAX_CURVE_ENTRIES 40000 //arbitrary
 		if (count > MAX_CURVE_ENTRIES) {
--- a/gfx/qcms/transform.c
+++ b/gfx/qcms/transform.c
@@ -646,17 +646,17 @@ static void qcms_transform_data_rgb_out_
 		*dest++ = clamp_u8(255*out_device_g);
 		*dest++ = clamp_u8(255*out_device_b);
 	}
 }
 #endif
 
 static void qcms_transform_data_gray_out_lut(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	for (i = 0; i < length; i++) {
 		float out_device_r, out_device_g, out_device_b;
 		unsigned char device = *src++;
 
 		float linear = transform->input_gamma_table_gray[device];
 
                 out_device_r = lut_interp_linear(linear, transform->output_gamma_lut_r, transform->output_gamma_lut_r_length);
 		out_device_g = lut_interp_linear(linear, transform->output_gamma_lut_g, transform->output_gamma_lut_g_length);
@@ -671,17 +671,17 @@ static void qcms_transform_data_gray_out
 /* Alpha is not corrected.
    A rationale for this is found in Alvy Ray's "Should Alpha Be Nonlinear If
    RGB Is?" Tech Memo 17 (December 14, 1998).
 	See: ftp://ftp.alvyray.com/Acrobat/17_Nonln.pdf
 */
 
 static void qcms_transform_data_graya_out_lut(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	for (i = 0; i < length; i++) {
 		float out_device_r, out_device_g, out_device_b;
 		unsigned char device = *src++;
 		unsigned char alpha = *src++;
 
 		float linear = transform->input_gamma_table_gray[device];
 
                 out_device_r = lut_interp_linear(linear, transform->output_gamma_lut_r, transform->output_gamma_lut_r_length);
@@ -693,17 +693,17 @@ static void qcms_transform_data_graya_ou
 		*dest++ = clamp_u8(out_device_b*255);
 		*dest++ = alpha;
 	}
 }
 
 
 static void qcms_transform_data_gray_out_precache(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	for (i = 0; i < length; i++) {
 		unsigned char device = *src++;
 		uint16_t gray;
 
 		float linear = transform->input_gamma_table_gray[device];
 
 		/* we could round here... */
 		gray = linear * 65535.;
@@ -711,17 +711,17 @@ static void qcms_transform_data_gray_out
 		*dest++ = transform->output_table_r->data[gray];
 		*dest++ = transform->output_table_g->data[gray];
 		*dest++ = transform->output_table_b->data[gray];
 	}
 }
 
 static void qcms_transform_data_graya_out_precache(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	for (i = 0; i < length; i++) {
 		unsigned char device = *src++;
 		unsigned char alpha = *src++;
 		uint16_t gray;
 
 		float linear = transform->input_gamma_table_gray[device];
 
 		/* we could round here... */
@@ -801,17 +801,17 @@ void qcms_transform_data_rgb_out_lut_sse
 #endif
 
 #if defined(_MSC_VER) && defined(_M_AMD64)
 #include <emmintrin.h>
 #endif
 
 static void qcms_transform_data_rgb_out_lut_sse(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
         char input_back[32];
 	/* Ensure we have a buffer that's 16 byte aligned regardless of the original
 	 * stack alignment. We can't use __attribute__((aligned(16))) or __declspec(align(32))
 	 * because they don't work on stack variables. gcc 4.4 does do the right thing 
 	 * on x86 but that's too new for us right now. For more info: gcc bug #16660 */
         float *input = (float*)(((uintptr_t)&input_back[16]) & ~0xf);
         /* share input and output locations to save having to keep the
@@ -939,17 +939,17 @@ static void qcms_transform_data_rgb_out_
 		*dest++ = transform->output_table_r->data[output[0]];
 		*dest++ = transform->output_table_g->data[output[1]];
 		*dest++ = transform->output_table_b->data[output[2]];
 	}
 }
 
 static void qcms_transform_data_rgba_out_lut_sse(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
         char input_back[32];
 	/* align input on 16 byte boundary */
         float *input = (float*)(((uintptr_t)&input_back[16]) & ~0xf);
         /* share input and output locations to save having to keep the
          * locations in separate registers */
         uint32_t* output = (uint32_t*)input;
 	for (i = 0; i < length; i++) {
@@ -1077,17 +1077,17 @@ static void qcms_transform_data_rgba_out
 		*dest++ = transform->output_table_b->data[output[2]];
 		*dest++ = alpha;
 	}
 }
 #endif
 
 static void qcms_transform_data_rgb_out_lut_precache(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
 	for (i = 0; i < length; i++) {
 		unsigned char device_r = *src++;
 		unsigned char device_g = *src++;
 		unsigned char device_b = *src++;
 		uint16_t r, g, b;
 
 		float linear_r = transform->input_gamma_table_r[device_r];
@@ -1110,17 +1110,17 @@ static void qcms_transform_data_rgb_out_
 		*dest++ = transform->output_table_r->data[r];
 		*dest++ = transform->output_table_g->data[g];
 		*dest++ = transform->output_table_b->data[b];
 	}
 }
 
 static void qcms_transform_data_rgba_out_lut_precache(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
 	for (i = 0; i < length; i++) {
 		unsigned char device_r = *src++;
 		unsigned char device_g = *src++;
 		unsigned char device_b = *src++;
 		unsigned char alpha = *src++;
 		uint16_t r, g, b;
 
@@ -1145,17 +1145,17 @@ static void qcms_transform_data_rgba_out
 		*dest++ = transform->output_table_g->data[g];
 		*dest++ = transform->output_table_b->data[b];
 		*dest++ = alpha;
 	}
 }
 
 static void qcms_transform_data_rgb_out_lut(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
 	for (i = 0; i < length; i++) {
 		unsigned char device_r = *src++;
 		unsigned char device_g = *src++;
 		unsigned char device_b = *src++;
 		float out_device_r, out_device_g, out_device_b;
 
 		float linear_r = transform->input_gamma_table_r[device_r];
@@ -1177,17 +1177,17 @@ static void qcms_transform_data_rgb_out_
 		*dest++ = clamp_u8(out_device_r*255);
 		*dest++ = clamp_u8(out_device_g*255);
 		*dest++ = clamp_u8(out_device_b*255);
 	}
 }
 
 static void qcms_transform_data_rgba_out_lut(qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length)
 {
-	int i;
+	unsigned int i;
 	float (*mat)[4] = transform->matrix;
 	for (i = 0; i < length; i++) {
 		unsigned char device_r = *src++;
 		unsigned char device_g = *src++;
 		unsigned char device_b = *src++;
 		unsigned char alpha = *src++;
 		float out_device_r, out_device_g, out_device_b;