Hi,

Attached is a diff that resolves a number of warnings I encountered when
porting pixman over to my RTOS.
Most examples compile cleanly now.
I had to move the definitions of PIXMAN_null, PIXMAN_any and related so
they become type-safe, otherwise my compiler gives a enumeration to int
cast warning. It is cleaner that way anyway.

--Rolland

diff -urN pixman-0.21.4.orig/pixman/pixman.c pixman-0.21.4/pixman/pixman.c
--- pixman-0.21.4.orig/pixman/pixman.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/pixman/pixman.c	2011-01-22 19:49:28.000000000 +0100
@@ -159,7 +159,7 @@
     is_dest_opaque >>= OPAQUE_SHIFT - 1;
     is_source_opaque >>= OPAQUE_SHIFT;
 
-    return operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
+    return (pixman_op_t)operator_table[op].opaque_info[is_dest_opaque | is_source_opaque];
 }
 
 /*
diff -urN pixman-0.21.4.orig/pixman/pixman-fast-path.c pixman-0.21.4/pixman/pixman-fast-path.c
--- pixman-0.21.4.orig/pixman/pixman-fast-path.c	2011-01-19 13:13:08.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-fast-path.c	2011-01-22 19:58:39.000000000 +0100
@@ -364,7 +364,7 @@
 				   int32_t                  width,
 				   int32_t                  height)
 {
-    uint32_t src, srca, s;
+    uint32_t src, s;
     uint32_t    *dst_line, *dst, d;
     uint32_t    *mask_line, *mask, ma;
     int dst_stride, mask_stride;
@@ -372,7 +372,6 @@
 
     src = _pixman_image_get_solid (imp, src_image, dst_image->bits.format);
 
-    srca = src >> 24;
     if (src == 0)
 	return;
 
diff -urN pixman-0.21.4.orig/pixman/pixman-fast-path.h pixman-0.21.4/pixman/pixman-fast-path.h
--- pixman-0.21.4.orig/pixman/pixman-fast-path.h	2011-01-19 13:13:08.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-fast-path.h	2011-01-22 19:53:12.000000000 +0100
@@ -265,7 +265,7 @@
     dst_type_t *dst_line;									\
     src_type_t *src_first_line;									\
     int       y;										\
-    pixman_fixed_t max_vx = max_vx; /* suppress uninitialized variable warning */		\
+    pixman_fixed_t max_vx = INT32_MAX; /* suppress uninitialized variable warning */		\
     pixman_fixed_t max_vy;									\
     pixman_vector_t v;										\
     pixman_fixed_t vx, vy;									\
diff -urN pixman-0.21.4.orig/pixman/pixman.h pixman-0.21.4/pixman/pixman.h
--- pixman-0.21.4.orig/pixman/pixman.h	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/pixman/pixman.h	2011-01-22 19:56:43.000000000 +0100
@@ -354,7 +354,8 @@
 #ifdef PIXMAN_USE_INTERNAL_API
     ,
     PIXMAN_N_OPERATORS,
-    PIXMAN_OP_NONE = PIXMAN_N_OPERATORS
+    PIXMAN_OP_NONE = PIXMAN_N_OPERATORS,
+    PIXMAN_OP_any = PIXMAN_N_OPERATORS + 1
 #endif
 } pixman_op_t;
 
@@ -719,7 +720,17 @@
 
 /* YUV formats */
     PIXMAN_yuy2 =	 PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
-    PIXMAN_yv12 =	 PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
+    PIXMAN_yv12 =	 PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0),
+
+/* These "formats" all have depth 0, so they
+ * will never clash with any real ones
+ */
+    PIXMAN_null =        PIXMAN_FORMAT (0, 0, 0, 0, 0, 0),
+    PIXMAN_solid =       PIXMAN_FORMAT (0, 1, 0, 0, 0, 0),
+    PIXMAN_pixbuf =      PIXMAN_FORMAT (0, 2, 0, 0, 0, 0),
+    PIXMAN_rpixbuf =     PIXMAN_FORMAT (0, 3, 0, 0, 0, 0),
+    PIXMAN_unknown =     PIXMAN_FORMAT (0, 4, 0, 0, 0, 0),
+    PIXMAN_any =         PIXMAN_FORMAT (0, 5, 0, 0, 0, 0)
 } pixman_format_code_t;
 
 /* Querying supported format values. */
diff -urN pixman-0.21.4.orig/pixman/pixman-image.c pixman-0.21.4/pixman/pixman-image.c
--- pixman-0.21.4.orig/pixman/pixman-image.c	2011-01-19 13:13:08.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-image.c	2011-01-22 19:57:37.000000000 +0100
@@ -717,7 +717,7 @@
     if (image->type == BITS)
 	return image->bits.format;
 
-    return 0;
+    return PIXMAN_null;
 }
 
 uint32_t
diff -urN pixman-0.21.4.orig/pixman/pixman-matrix.c pixman-0.21.4/pixman/pixman-matrix.c
--- pixman-0.21.4.orig/pixman/pixman-matrix.c	2011-01-19 13:13:08.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-matrix.c	2011-01-22 19:54:06.000000000 +0100
@@ -465,9 +465,6 @@
     return TRUE;
 }
 
-static const int a[3] = { 3, 3, 2 };
-static const int b[3] = { 2, 1, 1 };
-
 PIXMAN_EXPORT pixman_bool_t
 pixman_f_transform_invert (struct pixman_f_transform *      dst,
                            const struct pixman_f_transform *src)
diff -urN pixman-0.21.4.orig/pixman/pixman-private.h pixman-0.21.4/pixman/pixman-private.h
--- pixman-0.21.4.orig/pixman/pixman-private.h	2011-01-19 13:13:08.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-private.h	2011-01-22 19:36:14.000000000 +0100
@@ -572,16 +572,6 @@
 uint32_t *
 _pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask);
 
-/* These "formats" all have depth 0, so they
- * will never clash with any real ones
- */
-#define PIXMAN_null             PIXMAN_FORMAT (0, 0, 0, 0, 0, 0)
-#define PIXMAN_solid            PIXMAN_FORMAT (0, 1, 0, 0, 0, 0)
-#define PIXMAN_pixbuf		PIXMAN_FORMAT (0, 2, 0, 0, 0, 0)
-#define PIXMAN_rpixbuf		PIXMAN_FORMAT (0, 3, 0, 0, 0, 0)
-#define PIXMAN_unknown		PIXMAN_FORMAT (0, 4, 0, 0, 0, 0)
-#define PIXMAN_any		PIXMAN_FORMAT (0, 5, 0, 0, 0, 0)
-
 #define PIXMAN_OP_any		(PIXMAN_N_OPERATORS + 1)
 
 #define FAST_PATH_ID_TRANSFORM			(1 <<  0)
diff -urN pixman-0.21.4.orig/pixman/pixman-trap.c pixman-0.21.4/pixman/pixman-trap.c
--- pixman-0.21.4.orig/pixman/pixman-trap.c	2011-01-16 12:34:58.000000000 +0100
+++ pixman-0.21.4/pixman/pixman-trap.c	2011-01-22 20:01:34.000000000 +0100
@@ -235,7 +235,6 @@
                   pixman_trap_t *  traps)
 {
     int bpp;
-    int width;
     int height;
 
     pixman_fixed_t x_off_fixed;
@@ -245,7 +244,6 @@
 
     _pixman_image_validate (image);
     
-    width = image->bits.width;
     height = image->bits.height;
     bpp = PIXMAN_FORMAT_BPP (image->bits.format);
 
@@ -349,10 +347,8 @@
                             int                       y_off)
 {
     int bpp;
-    int width;
     int height;
 
-    pixman_fixed_t x_off_fixed;
     pixman_fixed_t y_off_fixed;
     pixman_edge_t l, r;
     pixman_fixed_t t, b;
@@ -364,11 +360,9 @@
     if (!pixman_trapezoid_valid (trap))
 	return;
 
-    width = image->bits.width;
     height = image->bits.height;
     bpp = PIXMAN_FORMAT_BPP (image->bits.format);
 
-    x_off_fixed = pixman_int_to_fixed (x_off);
     y_off_fixed = pixman_int_to_fixed (y_off);
 
     t = trap->top + y_off_fixed;
diff -urN pixman-0.21.4.orig/test/affine-test.c pixman-0.21.4/test/affine-test.c
--- pixman-0.21.4.orig/test/affine-test.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/affine-test.c	2011-01-22 19:42:14.000000000 +0100
@@ -40,9 +40,9 @@
     int                w, h;
     pixman_fixed_t     scale_x = 65536, scale_y = 65536;
     pixman_fixed_t     translate_x = 0, translate_y = 0;
-    int                op;
-    int                repeat = 0;
-    int                src_fmt, dst_fmt;
+    pixman_op_t        op;
+    pixman_repeat_t    repeat = PIXMAN_REPEAT_NONE;
+    pixman_format_code_t src_fmt, dst_fmt;
     uint32_t *         srcbuf;
     uint32_t *         dstbuf;
     uint32_t           crc32;
diff -urN pixman-0.21.4.orig/test/blitters-test.c pixman-0.21.4/test/blitters-test.c
--- pixman-0.21.4.orig/test/blitters-test.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/blitters-test.c	2011-01-22 19:42:00.000000000 +0100
@@ -78,7 +78,7 @@
     uint32_t *data = pixman_image_get_data (img);
     int height = pixman_image_get_height (img);
 
-    if (fmt != -1)
+    if (PIXMAN_FORMAT_BPP(fmt) != 0)
     {
 	/* mask unused 'x' part */
 	if (PIXMAN_FORMAT_BPP (fmt) - PIXMAN_FORMAT_DEPTH (fmt) &&
@@ -218,7 +218,7 @@
     PIXMAN_a1r1g1b1,
     PIXMAN_a1b1g1r1,
     PIXMAN_a1,
-    -1
+    PIXMAN_null
 };
 
 static pixman_format_code_t mask_fmt_list[] = {
@@ -226,7 +226,7 @@
     PIXMAN_a8,
     PIXMAN_a4,
     PIXMAN_a1,
-    -1
+    PIXMAN_null
 };
 
 
@@ -247,7 +247,7 @@
     int dst_x, dst_y;
     int mask_x, mask_y;
     int w, h;
-    int op;
+    pixman_op_t op;
     pixman_format_code_t src_fmt, dst_fmt, mask_fmt;
     uint32_t *dstbuf, *srcbuf, *maskbuf;
     uint32_t crc32;
@@ -305,7 +305,7 @@
     dst_y = lcg_rand_n (dst_height);
 
     mask_img = NULL;
-    mask_fmt = -1;
+    mask_fmt = PIXMAN_null;
     mask_x = 0;
     mask_y = 0;
     maskbuf = NULL;
@@ -385,7 +385,7 @@
 	printf ("---\n");
     }
 
-    free_random_image (0, src_img, -1);
+    free_random_image (0, src_img, PIXMAN_null);
     crc32 = free_random_image (0, dst_img, dst_fmt);
 
     if (mask_img)
@@ -393,7 +393,7 @@
 	if (srcbuf == maskbuf)
 	    pixman_image_unref(mask_img);
 	else
-	    free_random_image (0, mask_img, -1);
+	    free_random_image (0, mask_img, PIXMAN_null);
     }
 
     FLOAT_REGS_CORRUPTION_DETECTOR_FINISH ();
diff -urN pixman-0.21.4.orig/test/fetch-test.c pixman-0.21.4/test/fetch-test.c
--- pixman-0.21.4.orig/test/fetch-test.c	2010-12-17 22:55:23.000000000 +0100
+++ pixman-0.21.4/test/fetch-test.c	2011-01-22 18:47:56.000000000 +0100
@@ -117,6 +117,7 @@
     default:
 	assert(0);
     }
+    return 0;
 }
 
 
diff -urN pixman-0.21.4.orig/test/scaling-crash-test.c pixman-0.21.4/test/scaling-crash-test.c
--- pixman-0.21.4.orig/test/scaling-crash-test.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/scaling-crash-test.c	2011-01-22 19:46:26.000000000 +0100
@@ -95,21 +95,29 @@
     return result;
 }
 
-typedef struct info_t info_t;
-struct info_t
+typedef struct filter_info_t filter_info_t;
+struct filter_info_t
 {
-    int value;
+    pixman_filter_t value;
     char name[28];
 };
 
-static const info_t filters[] =
+static const filter_info_t filters[] =
 {
     { PIXMAN_FILTER_NEAREST, "NEAREST" },
     { PIXMAN_FILTER_BILINEAR, "BILINEAR" },
     { PIXMAN_FILTER_CONVOLUTION, "CONVOLUTION" },
 };
 
-static const info_t repeats[] =
+typedef struct repeat_info_t repeat_info_t;
+struct repeat_info_t
+{
+    pixman_repeat_t value;
+    char name[28];
+};
+
+
+static const repeat_info_t repeats[] =
 {
     { PIXMAN_REPEAT_PAD, "PAD" },
     { PIXMAN_REPEAT_REFLECT, "REFLECT" },
diff -urN pixman-0.21.4.orig/test/scaling-test.c pixman-0.21.4/test/scaling-test.c
--- pixman-0.21.4.orig/test/scaling-test.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/scaling-test.c	2011-01-22 19:48:09.000000000 +0100
@@ -40,9 +40,9 @@
     int                w, h;
     pixman_fixed_t     scale_x = 65536, scale_y = 65536;
     pixman_fixed_t     translate_x = 0, translate_y = 0;
-    int                op;
-    int                repeat = 0;
-    int                src_fmt, dst_fmt;
+    pixman_op_t        op;
+    pixman_repeat_t    repeat = PIXMAN_REPEAT_NONE;
+    pixman_format_code_t src_fmt, dst_fmt;
     uint32_t *         srcbuf;
     uint32_t *         dstbuf;
     uint32_t           crc32;
diff -urN pixman-0.21.4.orig/test/stress-test.c pixman-0.21.4/test/stress-test.c
--- pixman-0.21.4.orig/test/stress-test.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/stress-test.c	2011-01-22 19:22:36.000000000 +0100
@@ -130,6 +130,7 @@
 	assert (0);
 	break;
     }
+    return 0;
 }
 
 static void
diff -urN pixman-0.21.4.orig/test/utils.c pixman-0.21.4/test/utils.c
--- pixman-0.21.4.orig/test/utils.c	2011-01-19 13:13:01.000000000 +0100
+++ pixman-0.21.4/test/utils.c	2011-01-22 19:47:36.000000000 +0100
@@ -295,7 +295,7 @@
 #else
 
 void *
-fence_malloc (uint32_t len)
+fence_malloc (int64_t len)
 {
     return malloc (len);
 }
@@ -450,6 +450,8 @@
 #endif
 }
 
+#ifdef HAVE_SIGACTION
+#ifdef HAVE_ALARM
 static const char *global_msg;
 
 static void
@@ -458,6 +460,8 @@
     printf ("%s\n", global_msg);
     exit (1);
 }
+#endif
+#endif
 
 void
 fail_after (int seconds, const char *msg)
_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to