[cairo-commit] 3 commits - src/cairoint.h src/cairo-xlib-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed May 28 10:17:14 PDT 2008


 src/cairo-xlib-surface.c |    5 +++--
 src/cairoint.h           |    4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 295dee36e3043fd63a2a93715f144aad92d16917
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 13:10:07 2008 -0400

    [cairo-xlib] Use newly-added COMPILE_TIME_ASSERT

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 31b5a7c..42d6ac2 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -3222,7 +3222,7 @@ typedef struct {
 } cairo_xlib_glyph_t;
 
 /* compile-time assert that #cairo_xlib_glyph_t is the same size as #cairo_glyph_t */
-typedef int cairo_xlib_glyph_t_size_assertion [sizeof (cairo_xlib_glyph_t) == sizeof (cairo_glyph_t) ? 1 : -1];
+COMPILE_TIME_ASSERT (sizeof (cairo_xlib_glyph_t) == sizeof (cairo_glyph_t));
 
 static cairo_status_t
 _cairo_xlib_surface_emit_glyphs_chunk (cairo_xlib_surface_t *dst,
commit 2e4d6acd09f0af5d51c4da5707b3430cdd54f0a5
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 13:09:52 2008 -0400

    [cairoint.h] Add COMPILE_TIME_ASSERT()

diff --git a/src/cairoint.h b/src/cairoint.h
index bb60151..f1bee25 100755
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -127,6 +127,10 @@ do {					\
     static const int NOT_REACHED = 0;	\
     assert (NOT_REACHED);		\
 } while (0)
+#define COMPILE_TIME_ASSERT1(condition, line)		\
+    typedef int compile_time_assertion_at_line_##line##_failed [(condition)?1:-1];
+#define COMPILE_TIME_ASSERT0(condition, line)	COMPILE_TIME_ASSERT1(condition, line)
+#define COMPILE_TIME_ASSERT(condition)		COMPILE_TIME_ASSERT0(condition, __LINE__)
 
 #define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff))
 #define CAIRO_ALPHA_SHORT_IS_OPAQUE(alpha) ((alpha) >= 0xff00)
commit 043ed895adb4f17912ae5c44d4c63ca6350d5b75
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 28 13:09:43 2008 -0400

    [cairo-xlib] Fix compiler warning

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index c163c63..31b5a7c 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1617,6 +1617,7 @@ _cairo_xlib_surface_solid_fill_rectangles (cairo_xlib_surface_t    *surface,
 					   int			   num_rects)
 {
     XGCValues gcv;
+    GC xgc;
     int a_width=0, r_width=0, g_width=0, b_width=0;
     int a_shift=0, r_shift=0, g_shift=0, b_shift=0;
     int a = color->alpha_short >> 8;
@@ -1650,7 +1651,7 @@ _cairo_xlib_surface_solid_fill_rectangles (cairo_xlib_surface_t    *surface,
 					       _field_from_8 (b, 3, 0)];
     }
 
-    GC xgc = XCreateGC (surface->dpy, surface->drawable, GCForeground,
+    xgc = XCreateGC (surface->dpy, surface->drawable, GCForeground,
 			&gcv);
     if (!xgc)
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);


More information about the cairo-commit mailing list