[cairo-commit] 2 commits - src/cairo-image-compositor.c src/cairo-recording-surface.c src/cairo-recording-surface-private.h

Chris Wilson ickle at kemper.freedesktop.org
Tue Jun 11 02:08:21 PDT 2013


 src/cairo-image-compositor.c          |    2 +-
 src/cairo-recording-surface-private.h |    4 ++--
 src/cairo-recording-surface.c         |   18 +++++++++---------
 3 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit e519d6f9860c7f0bc51f1e8a17505f2dc372c938
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jun 11 10:00:56 2013 +0100

    recording: Fix inconsistent usage of types for indices
    
    We were wantonly mixing unsigned/signed integers for our index and
    counters, leading to compiler warnings. Be bold, and use unsigned
    consistently.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-recording-surface-private.h b/src/cairo-recording-surface-private.h
index 0235b0f..4919481 100644
--- a/src/cairo-recording-surface-private.h
+++ b/src/cairo-recording-surface-private.h
@@ -133,8 +133,8 @@ typedef struct _cairo_recording_surface {
     cairo_bool_t unbounded;
 
     cairo_array_t commands;
-    int *indices;
-    int num_indices;
+    unsigned int *indices;
+    unsigned int num_indices;
     cairo_bool_t optimize_clears;
 
     struct bbtree {
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index c6d34c0..28d8abd 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -257,7 +257,7 @@ static cairo_bool_t box_outside (const cairo_box_t *a, const cairo_box_t *b)
 static void
 bbtree_foreach_mark_visible (struct bbtree *bbt,
 			     const cairo_box_t *box,
-			     int **indices)
+			     unsigned int **indices)
 {
     cairo_command_header_t *chain;
 
@@ -270,13 +270,13 @@ bbtree_foreach_mark_visible (struct bbtree *bbt,
 	bbtree_foreach_mark_visible (bbt->right, box, indices);
 }
 
-static inline int intcmp (const int a, const int b)
+static inline int intcmp (const unsigned int a, const unsigned int b)
 {
     return a - b;
 }
-CAIRO_COMBSORT_DECLARE (sort_indices, int, intcmp)
+CAIRO_COMBSORT_DECLARE (sort_indices, unsigned int, intcmp)
 
-static inline int sizecmp (int a, int b, cairo_command_header_t **elements)
+static inline int sizecmp (unsigned int a, unsigned int b, cairo_command_header_t **elements)
 {
     const cairo_rectangle_int_t *r;
 
@@ -288,7 +288,7 @@ static inline int sizecmp (int a, int b, cairo_command_header_t **elements)
 
     return b - a;
 }
-CAIRO_COMBSORT_DECLARE_WITH_DATA (sort_commands, int, sizecmp)
+CAIRO_COMBSORT_DECLARE_WITH_DATA (sort_commands, unsigned int, sizecmp)
 
 static void
 _cairo_recording_surface_destroy_bbtree (cairo_recording_surface_t *surface)
@@ -320,9 +320,9 @@ static cairo_status_t
 _cairo_recording_surface_create_bbtree (cairo_recording_surface_t *surface)
 {
     cairo_command_t **elements = _cairo_array_index (&surface->commands, 0);
+    unsigned int *indices;
     cairo_status_t status;
-    int i, count;
-    int *indices;
+    unsigned int i, count;
 
     count = surface->commands.num_elements;
     if (count > surface->num_indices) {
@@ -1583,7 +1583,7 @@ static int
 _cairo_recording_surface_get_visible_commands (cairo_recording_surface_t *surface,
 					       const cairo_rectangle_int_t *extents)
 {
-    int num_visible, *indices;
+    unsigned int num_visible, *indices;
     cairo_box_t box;
 
     _cairo_box_from_rectangle (&box, extents);
@@ -1618,7 +1618,7 @@ _cairo_recording_surface_replay_internal (cairo_recording_surface_t	*surface,
     cairo_rectangle_int_t extents;
     cairo_bool_t use_indices = FALSE;
     const cairo_rectangle_int_t *r;
-    int i, num_elements;
+    unsigned int i, num_elements;
 
     if (unlikely (surface->base.status))
 	return surface->base.status;
commit b45c79ff8a8e7c5cf4af1498d854a85c818d9268
Author: Bryce W. Harrington <b.harrington at samsung.com>
Date:   Mon Jun 10 19:01:09 2013 +0000

    image: Quell warning about signed/unsigned int comparison.
    
    Restore (int) cast that was dropped in e7e1ac23.
    
    Signed-off-by: Bryce Harrington <b.harrington at samsung.com>

diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
index 19372be..a79dc40 100644
--- a/src/cairo-image-compositor.c
+++ b/src/cairo-image-compositor.c
@@ -1548,7 +1548,7 @@ typedef struct _cairo_image_span_renderer {
 	} mask;
     } u;
     uint8_t _buf[0];
-#define SZ_BUF (sizeof (cairo_abstract_span_renderer_t) - sizeof (cairo_image_span_renderer_t))
+#define SZ_BUF (int)(sizeof (cairo_abstract_span_renderer_t) - sizeof (cairo_image_span_renderer_t))
 } cairo_image_span_renderer_t;
 COMPILE_TIME_ASSERT (sizeof (cairo_image_span_renderer_t) <= sizeof (cairo_abstract_span_renderer_t));
 


More information about the cairo-commit mailing list