[cairo-commit] 2 commits - src/cairo-pattern.c src/cairo-ps-surface.c

Carl Worth cworth at kemper.freedesktop.org
Fri Mar 2 00:37:35 PST 2007


 src/cairo-pattern.c    |    3 ++-
 src/cairo-ps-surface.c |    7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
diff-tree c12a4571affe9fdd2bb4620c448aded43584bb54 (from 3685a66b5b9cb0af10b44985dc1e9ef1c82ad77b)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Mar 2 00:37:21 2007 -0800

    Cast -1 values to unsigned to quiet the compiler.
    
    Marking the magic values to indicate we really did mean to type them.

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 154ad82..b7fb761 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1303,7 +1303,8 @@ _cairo_pattern_acquire_surface_for_surfa
 	/* If we're repeating, we just play it safe and clone the entire surface. */
 	/* If requested width and height are -1, clone the entire surface.
 	 * This is relied on in the svg backend. */
-	if (attr->extend == CAIRO_EXTEND_REPEAT || (width == -1 && height == -1)) {
+	if (attr->extend == CAIRO_EXTEND_REPEAT ||
+	    (width == (unsigned int) -1 && height == (unsigned int) -1)) {
 	    x = extents.x;
 	    y = extents.y;
 	    width = extents.width;
diff-tree 3685a66b5b9cb0af10b44985dc1e9ef1c82ad77b (from d48bb4fbe876a93199ba48fcf5f32734fbe18ba9)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Mar 2 00:22:57 2007 -0800

    Cast away a const to quiet a compiler warning.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f971cf7..522cdb6 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1351,7 +1351,12 @@ surface_pattern_supported (const cairo_s
 	return FALSE;
 */
 
-    extend = cairo_pattern_get_extend (&pattern->base);
+    /* Cast away the const, trusting get_extend not to muck with it.
+     * And I really wish I had a way to cast away just the const, and
+     * not potentially coerce this pointer to an incorrect type at the
+     * same time. :-(
+     */
+    extend = cairo_pattern_get_extend ((cairo_pattern_t*)&pattern->base);
     switch (extend) {
     case CAIRO_EXTEND_NONE:
     case CAIRO_EXTEND_REPEAT:


More information about the cairo-commit mailing list