[cairo-commit] 10 commits - configure.in pixman/src src/cairo-array.c src/cairo.c src/cairo-font.c src/cairo-ft-font.c src/cairo-gstate.c src/cairo-hash.c src/cairo-image-surface.c src/cairoint.h src/cairo-meta-surface-private.h src/cairo-output-stream.c src/cairo-path-stroke.c src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-png.c src/cairo-ps-surface.c src/cairo-scaled-font.c src/cairo-scaled-font-subsets.c src/cairo-scaled-font-subsets-private.h src/cairo-surface.c src/cairo-svg-surface.c src/cairo-truetype-subset.c src/cairo-type1-subset.c src/cairo-xlib-surface.c

Carl Worth cworth at kemper.freedesktop.org
Mon Aug 7 15:23:24 PDT 2006


 configure.in                            |    9 +++--
 pixman/src/fbmmx.c                      |    8 ++--
 pixman/src/fbpict.c                     |   13 +++++++
 pixman/src/icformat.c                   |   12 +++----
 pixman/src/pixman.h                     |   10 +++---
 pixman/src/pixregion.c                  |   53 +++++++++++++-------------------
 src/cairo-array.c                       |    6 +--
 src/cairo-font.c                        |    8 ++--
 src/cairo-ft-font.c                     |    5 +++
 src/cairo-gstate.c                      |    2 -
 src/cairo-hash.c                        |    2 -
 src/cairo-image-surface.c               |   11 ++++++
 src/cairo-meta-surface-private.h        |    2 -
 src/cairo-output-stream.c               |    2 -
 src/cairo-path-stroke.c                 |    4 +-
 src/cairo-pattern.c                     |   32 +++++++++----------
 src/cairo-pdf-surface.c                 |   19 ++++++-----
 src/cairo-png.c                         |    8 ++--
 src/cairo-ps-surface.c                  |    9 ++---
 src/cairo-scaled-font-subsets-private.h |    2 -
 src/cairo-scaled-font-subsets.c         |    6 +--
 src/cairo-scaled-font.c                 |    8 ++--
 src/cairo-surface.c                     |   12 +++----
 src/cairo-svg-surface.c                 |    8 ++--
 src/cairo-truetype-subset.c             |   14 ++++----
 src/cairo-type1-subset.c                |    4 +-
 src/cairo-xlib-surface.c                |   20 +++++++++---
 src/cairo.c                             |    6 +--
 src/cairoint.h                          |   24 +++++++-------
 29 files changed, 177 insertions(+), 142 deletions(-)

New commits:
diff-tree 20c3ff96de05365ee65301ccd3c43e7bcb19f49b (from 959b85e98c8a0f546c9117da83f84c99ed00370f)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Aug 7 15:18:38 2006 -0700

    Fix some signed/unsigned comparison warnings that cropped up during the warnings-cleanup branch

diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
index 24b1b47..3f2d390 100644
--- a/src/cairo-meta-surface-private.h
+++ b/src/cairo-meta-surface-private.h
@@ -97,7 +97,7 @@ typedef struct _cairo_command_show_glyph
     cairo_operator_t		 op;
     cairo_pattern_union_t	 source;
     cairo_glyph_t		*glyphs;
-    int				 num_glyphs;
+    unsigned int		 num_glyphs;
     cairo_scaled_font_t		*scaled_font;
 } cairo_command_show_glyphs_t;
 
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index ed8d084..132c604 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1601,7 +1601,7 @@ _cairo_pdf_surface_emit_type1_font_subse
     cairo_type1_subset_t subset;
     unsigned long length, compressed_length;
     char *compressed;
-    int i;
+    unsigned int i;
     char name[64];
 
     snprintf (name, sizeof name, "CairoFont-%d-%d",
@@ -1711,7 +1711,7 @@ _cairo_pdf_surface_emit_truetype_font_su
     cairo_truetype_subset_t subset;
     unsigned long compressed_length;
     char *compressed;
-    int i;
+    unsigned int i;
 
     status = _cairo_truetype_subset_init (&subset, font_subset);
     if (status)
@@ -1944,7 +1944,7 @@ _cairo_pdf_surface_emit_type3_font_subse
     cairo_pdf_resource_t *glyphs, encoding, char_procs, subset_resource;
     cairo_pdf_font_t font;
     cairo_matrix_t matrix;
-    int i;
+    unsigned int i;
 
     glyphs = malloc (font_subset->num_glyphs * sizeof (cairo_pdf_resource_t));
     if (glyphs == NULL) {
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f93643d..e0b611d 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -425,8 +425,7 @@ _cairo_ps_surface_emit_truetype_font_sub
 {
     cairo_truetype_subset_t subset;
     cairo_status_t status;
-    int i;
-    unsigned int begin, end;
+    unsigned int i, begin, end;
 
     status = _cairo_truetype_subset_init (&subset, font_subset);
     if (status)
@@ -628,7 +627,7 @@ _cairo_ps_surface_emit_type3_font_subset
 
 {
     cairo_matrix_t matrix;
-    int i;
+    unsigned int i;
 
     _cairo_output_stream_printf (surface->final_stream,
 				 "%% _cairo_ps_surface_emit_type3_font_subset\n");
diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h
index 08c8996..c41e477 100644
--- a/src/cairo-scaled-font-subsets-private.h
+++ b/src/cairo-scaled-font-subsets-private.h
@@ -50,7 +50,7 @@ typedef struct _cairo_scaled_font_subset
      * Value of glyphs array is scaled_font_glyph_index.
      */
     unsigned long *glyphs;
-    int num_glyphs;
+    unsigned int num_glyphs;
 } cairo_scaled_font_subset_t;
 
 /**
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 653c9c4..448ddfe 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -625,7 +625,7 @@ _cairo_svg_document_emit_font_subset (ca
 				      void				*closure)
 {
     cairo_svg_document_t *document = closure;
-    int i;
+    unsigned int i;
 
     for (i = 0; i < font_subset->num_glyphs; i++) {
 	_cairo_svg_document_emit_glyph (document,
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 4769027..5a3b2e1 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -51,7 +51,7 @@ typedef struct _cairo_truetype_font {
 
     struct {
 	char *base_font;
-	int num_glyphs;
+	unsigned int num_glyphs;
 	int *widths;
 	long x_min, y_min, x_max, y_max;
 	long ascent, descent;
@@ -445,7 +445,7 @@ static int
 cairo_truetype_font_write_cmap_table (cairo_truetype_font_t *font,
 				      unsigned long          tag)
 {
-    int i;
+    unsigned int i;
 
     cairo_truetype_font_write_be16 (font, 0);
     cairo_truetype_font_write_be16 (font, 1);
@@ -549,7 +549,7 @@ cairo_truetype_font_write_glyf_table (ca
     tt_head_t header;
     unsigned long begin, end;
     unsigned char *buffer;
-    int i;
+    unsigned int i;
     union {
 	unsigned char *bytes;
 	uint16_t      *short_offsets;
@@ -648,7 +648,7 @@ cairo_truetype_font_write_hmtx_table (ca
     unsigned long long_entry_size;
     unsigned long short_entry_size;
     short *p;
-    int i;
+    unsigned int i;
     tt_hhea_t hhea;
     int num_hmetrics;
 
@@ -691,7 +691,7 @@ static int
 cairo_truetype_font_write_loca_table (cairo_truetype_font_t *font,
 				      unsigned long          tag)
 {
-    int i;
+    unsigned int i;
     tt_head_t header;
     unsigned long size;
 
@@ -832,7 +832,7 @@ cairo_truetype_font_generate (cairo_true
 {
     unsigned long start, end, next;
     uint32_t checksum, *checksum_location;
-    int i;
+    unsigned int i;
 
     if (cairo_truetype_font_write_offset_table (font))
 	goto fail;
@@ -891,7 +891,7 @@ _cairo_truetype_subset_init (cairo_truet
     const char *data = NULL; /* squelch bogus compiler warning */
     unsigned long length = 0; /* squelch bogus compiler warning */
     unsigned long parent_glyph, offsets_length;
-    int i;
+    unsigned int i;
     const unsigned long *string_offsets = NULL;
     unsigned long num_strings = 0;
 
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 1daa2f4..26ac97a 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -53,7 +53,7 @@ typedef struct _cairo_type1_font_subset 
 	cairo_unscaled_font_t *unscaled_font;
 	unsigned int font_id;
 	char *base_font;
-	int num_glyphs;
+	unsigned int num_glyphs;
 	long x_min, y_min, x_max, y_max;
 	long ascent, descent;
 
@@ -958,7 +958,7 @@ _cairo_type1_subset_init (cairo_type1_su
     cairo_type1_font_subset_t *font;
     cairo_status_t status;
     unsigned long parent_glyph, length;
-    int i;
+    unsigned int i;
     cairo_unscaled_font_t *unscaled_font;
 
     /* XXX: Need to fix this to work with a general cairo_unscaled_font_t. */
diff-tree 959b85e98c8a0f546c9117da83f84c99ed00370f (from parents)
Merge: f1c70a01391705a22dd882f2a88c6dffbc08f0fe 7ee94c0285b0f7352506622d16aff9339ba65d0c
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Aug 7 15:06:47 2006 -0700

    Merge branch 'warnings-cleanup' into cairo
    
    Conflicts:
    
    	src/cairo-font-subset.c

diff-tree 7ee94c0285b0f7352506622d16aff9339ba65d0c (from 43b579d757ded66f71da8a0e215abd7bccdfd695)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Jul 31 12:03:40 2006 -0700

    Squelch an annoying -Wswitch-enum warning by not using switch

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 14adfd1..6bf8697 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -68,17 +68,17 @@ static const cairo_solid_pattern_t cairo
 static const cairo_pattern_t *
 _cairo_pattern_nil_for_status (cairo_status_t status)
 {
-    switch (status) {
-    case CAIRO_STATUS_NULL_POINTER:
+    /* A switch statement would be more natural here, but we're
+     * avoiding that to prevent a "false positive" warning from
+     * -Wswitch-enum, (and I don't want to maintain a list of all
+     * status values here). */
+    if (status == CAIRO_STATUS_NULL_POINTER)
 	return &cairo_pattern_nil_null_pointer.base;
-    case CAIRO_STATUS_FILE_NOT_FOUND:
+    if (status == CAIRO_STATUS_FILE_NOT_FOUND)
 	return &cairo_pattern_nil_file_not_found.base;
-    case CAIRO_STATUS_READ_ERROR:
+    if (status == CAIRO_STATUS_READ_ERROR)
 	return &cairo_pattern_nil_read_error.base;
-    case CAIRO_STATUS_NO_MEMORY:
-    default:
-	return &cairo_pattern_nil.base;
-    }
+    return &cairo_pattern_nil.base;
 }
 
 /**
diff-tree 43b579d757ded66f71da8a0e215abd7bccdfd695 (from d1f9bef30ea7268fee74af50c0e9325e1ec0929c)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Jul 31 11:47:45 2006 -0700

    Add -Wswitch-enum compiler flag and fix all trivial warnings

diff --git a/configure.in b/configure.in
index 9be858c..6558a3d 100644
--- a/configure.in
+++ b/configure.in
@@ -535,7 +535,7 @@ WARN_CFLAGS=""
 if test "x$GCC" = "xyes"; then
 	WARN_CFLAGS="-Wall -Wsign-compare -Werror-implicit-function-declaration \
 	-Wstrict-aliasing=2 -Wpointer-arith -Wwrite-strings -Winit-self \
-	-Wunsafe-loop-optimizations \
+	-Wswitch-enum -Wunsafe-loop-optimizations \
 	-Wpacked -Wmissing-format-attribute -Wstrict-prototypes \
 	-Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement \
 	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 0d547d9..07c293a 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1798,6 +1798,17 @@ pixman_composite (pixman_operator_t	op,
 	    }
 	}
 	break;
+    case PIXMAN_OPERATOR_CLEAR:
+    case PIXMAN_OPERATOR_DST:
+    case PIXMAN_OPERATOR_OVER_REVERSE:
+    case PIXMAN_OPERATOR_IN:
+    case PIXMAN_OPERATOR_IN_REVERSE:
+    case PIXMAN_OPERATOR_OUT:
+    case PIXMAN_OPERATOR_OUT_REVERSE:
+    case PIXMAN_OPERATOR_ATOP:
+    case PIXMAN_OPERATOR_ATOP_REVERSE:
+    case PIXMAN_OPERATOR_XOR:
+    case PIXMAN_OPERATOR_SATURATE:
     default:
 	/* For any operator not specifically handled above we default out to the general code. */
 	func = NULL;
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 18aa68c..6cc54bf 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -978,6 +978,7 @@ _render_glyph_outline (FT_Face          
 	    switch (font_options->subpixel_order) {
 	    case CAIRO_SUBPIXEL_ORDER_RGB:
 	    case CAIRO_SUBPIXEL_ORDER_BGR:
+	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
 	    default:
 		matrix.xx *= 3;
 		hmul = 3;
@@ -2204,6 +2205,9 @@ cairo_ft_font_options_substitute (const 
 	    int hint_style;
 
 	    switch (options->hint_style) {
+	    case CAIRO_HINT_STYLE_NONE:
+		hint_style = FC_HINT_NONE;
+		break;
 	    case CAIRO_HINT_STYLE_SLIGHT:
 		hint_style = FC_HINT_SLIGHT;
 		break;
@@ -2211,6 +2215,7 @@ cairo_ft_font_options_substitute (const 
 		hint_style = FC_HINT_MEDIUM;
 		break;
 	    case CAIRO_HINT_STYLE_FULL:
+	    case CAIRO_HINT_STYLE_DEFAULT:
 	    default:
 		hint_style = FC_HINT_FULL;
 		break;
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 8aca7bc..64c5cfe 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -639,6 +639,12 @@ _cairo_image_surface_set_filter (cairo_i
     case CAIRO_FILTER_BILINEAR:
 	pixman_filter = PIXMAN_FILTER_BILINEAR;
 	break;
+    case CAIRO_FILTER_GAUSSIAN:
+	/* XXX: The GAUSSIAN value has no implementation in cairo
+	 * whatsoever, so it was really a mistake to have it in the
+	 * API. We could fix this by officially deprecating it, or
+	 * else inventing semantics and providing an actual
+	 * implementation for it. */
     default:
 	pixman_filter = PIXMAN_FILTER_BEST;
     }
@@ -895,6 +901,9 @@ _cairo_image_surface_composite_trapezoid
 	mask_stride = (width + 31)/8;
 	mask_bpp = 1;
  	break;
+    case CAIRO_ANTIALIAS_GRAY:
+    case CAIRO_ANTIALIAS_SUBPIXEL:
+    case CAIRO_ANTIALIAS_DEFAULT:
     default:
 	format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
 	mask_stride = (width + 3) & ~3;
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 463c0e8..14adfd1 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -75,8 +75,8 @@ _cairo_pattern_nil_for_status (cairo_sta
 	return &cairo_pattern_nil_file_not_found.base;
     case CAIRO_STATUS_READ_ERROR:
 	return &cairo_pattern_nil_read_error.base;
-    default:
     case CAIRO_STATUS_NO_MEMORY:
+    default:
 	return &cairo_pattern_nil.base;
     }
 }
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index ea436e6..e7a87e4 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -893,8 +893,12 @@ emit_surface_pattern (cairo_pdf_surface_
 	xstep = image->width;
 	ystep = image->height;
 	break;
+    /* All the reset should have been analyzed away, so this case
+     * should be unreachable. */
+    case CAIRO_EXTEND_REFLECT:
+    case CAIRO_EXTEND_PAD:
     default:
-	ASSERT_NOT_REACHED; /* all others should be analyzed away */
+	ASSERT_NOT_REACHED;
 	xstep = 0;
 	ystep = 0;
     }
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 24c66a0..b9500bf 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -177,6 +177,8 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t form
 	return 1;
     case CAIRO_FORMAT_A8:
 	return 8;
+    case CAIRO_FORMAT_RGB16_565:
+	return 16;
     case CAIRO_FORMAT_RGB24:
 	return 24;
     case CAIRO_FORMAT_ARGB32:
@@ -963,6 +965,12 @@ _cairo_xlib_surface_set_filter (cairo_xl
     case CAIRO_FILTER_BILINEAR:
 	render_filter = FilterBilinear;
 	break;
+    case CAIRO_FILTER_GAUSSIAN:
+	/* XXX: The GAUSSIAN value has no implementation in cairo
+	 * whatsoever, so it was really a mistake to have it in the
+	 * API. We could fix this by officially deprecating it, or
+	 * else inventing semantics and providing an actual
+	 * implementation for it. */
     default:
 	render_filter = FilterBest;
 	break;
@@ -1372,6 +1380,7 @@ _cairo_xlib_surface_composite (cairo_ope
 			dst_x, dst_y, width, height);
 	break;
 
+    case DO_UNSUPPORTED:
     default:
 	ASSERT_NOT_REACHED;
     }
@@ -1561,6 +1570,9 @@ _cairo_xlib_surface_composite_trapezoids
     case CAIRO_ANTIALIAS_NONE:
 	pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA1);
 	break;
+    case CAIRO_ANTIALIAS_GRAY:
+    case CAIRO_ANTIALIAS_SUBPIXEL:
+    case CAIRO_ANTIALIAS_DEFAULT:
     default:
 	pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA8);
 	break;
diff-tree d1f9bef30ea7268fee74af50c0e9325e1ec0929c (from 744ef3bf698f9109e82244c5889d0d809b2df70c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 7 14:24:32 2006 -0700

    Add -Wunsafe-loop-optimizations compiler flag and fix all warnings

diff --git a/configure.in b/configure.in
index 928e26b..9be858c 100644
--- a/configure.in
+++ b/configure.in
@@ -535,6 +535,7 @@ WARN_CFLAGS=""
 if test "x$GCC" = "xyes"; then
 	WARN_CFLAGS="-Wall -Wsign-compare -Werror-implicit-function-declaration \
 	-Wstrict-aliasing=2 -Wpointer-arith -Wwrite-strings -Winit-self \
+	-Wunsafe-loop-optimizations \
 	-Wpacked -Wmissing-format-attribute -Wstrict-prototypes \
 	-Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement \
 	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index 00856ef..bc746cf 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -1060,7 +1060,7 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pi
 
     while (height--)
     {
-	int twidth = width;
+	unsigned int twidth = width;
 	CARD32 *p = (CARD32 *)maskLine;
 	CARD32 *q = (CARD32 *)dstLine;
 
@@ -2020,7 +2020,7 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pi
 
     while (height--)
     {
-	int twidth = width;
+	unsigned int twidth = width;
 	CARD32 *p = (CARD32 *)maskLine;
 	CARD16 *q = (CARD16 *)dstLine;
 
@@ -2270,7 +2270,7 @@ fbSolidFillmmx (FbPixels	*pDraw,
 
     while (height--)
     {
-	int w;
+	unsigned int w;
 	CARD8 *d = byte_line;
 	byte_line += stride;
 	w = byte_width;
@@ -2386,7 +2386,7 @@ fbCopyAreammx (FbPixels	*pSrc,
 
     while (height--)
     {
-	int w;
+	unsigned int w;
 	CARD8 *s = src_bytes;
 	CARD8 *d = dst_bytes;
 	src_bytes += src_stride;
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 5384a4f..24c66a0 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2423,7 +2423,7 @@ _cairo_xlib_surface_add_glyph (Display *
 	break;
     case CAIRO_FORMAT_ARGB32:
 	if (_native_byte_order_lsb() != (ImageByteOrder (dpy) == LSBFirst)) {
-	    int		    c = glyph_surface->stride * glyph_surface->height;
+	    unsigned int    c = glyph_surface->stride * glyph_surface->height;
 	    unsigned char   *d;
 	    unsigned char   *new, *n;
 
diff-tree 744ef3bf698f9109e82244c5889d0d809b2df70c (from 00711022089936e08b8651591629ca344a3fa71e)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 7 13:47:01 2006 -0700

    Add several compiler warning flags (no code changes needed)
    
    The flags added here are as follows:
    
    -Werror-implicit-function-declaration Wstrict-aliasing=2
    -Wwrite-strings Winit-self Wpacked Wmissing-format-attribute
    -Wdeclaration-after-statement

diff --git a/configure.in b/configure.in
index 7e1b3e3..928e26b 100644
--- a/configure.in
+++ b/configure.in
@@ -533,9 +533,11 @@ dnl Use lots of warning flags with GCC
 WARN_CFLAGS=""
 
 if test "x$GCC" = "xyes"; then
-	WARN_CFLAGS="-Wall -Wsign-compare -Wpointer-arith -Wstrict-prototypes \
-	-Wmissing-prototypes -Wmissing-declarations \
-	-Wnested-externs -fno-strict-aliasing -Wold-style-definition -Wwrite-strings"
+	WARN_CFLAGS="-Wall -Wsign-compare -Werror-implicit-function-declaration \
+	-Wstrict-aliasing=2 -Wpointer-arith -Wwrite-strings -Winit-self \
+	-Wpacked -Wmissing-format-attribute -Wstrict-prototypes \
+	-Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement \
+	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
 fi
 
 AC_SUBST(WARN_CFLAGS)
diff-tree 00711022089936e08b8651591629ca344a3fa71e (from eb9caf083353f3430f786da717b6c56b13f82ecb)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Aug 7 13:13:33 2006 -0700

    Add -Wwrite-strings compiler flag and fix all warnings

diff --git a/configure.in b/configure.in
index cb2fa23..7e1b3e3 100644
--- a/configure.in
+++ b/configure.in
@@ -535,7 +535,7 @@ WARN_CFLAGS=""
 if test "x$GCC" = "xyes"; then
 	WARN_CFLAGS="-Wall -Wsign-compare -Wpointer-arith -Wstrict-prototypes \
 	-Wmissing-prototypes -Wmissing-declarations \
-	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
+	-Wnested-externs -fno-strict-aliasing -Wold-style-definition -Wwrite-strings"
 fi
 
 AC_SUBST(WARN_CFLAGS)
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 37394a8..7de8c08 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1474,7 +1474,7 @@ static cairo_status_t
 emit_image (cairo_ps_surface_t    *surface,
 	    cairo_image_surface_t *image,
 	    cairo_matrix_t	  *matrix,
-	    char		  *name)
+	    const char		  *name)
 {
     cairo_status_t status;
     unsigned char *rgb, *compressed;
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 7e96e87..5384a4f 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -934,7 +934,7 @@ static cairo_status_t
 _cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
 				cairo_filter_t	     filter)
 {
-    char *render_filter;
+    const char *render_filter;
 
     if (!surface->src_picture)
 	return CAIRO_STATUS_SUCCESS;
@@ -969,7 +969,7 @@ _cairo_xlib_surface_set_filter (cairo_xl
     }
 
     XRenderSetPictureFilter (surface->dpy, surface->src_picture,
-			     render_filter, NULL, 0);
+			     (char *) render_filter, NULL, 0);
 
     return CAIRO_STATUS_SUCCESS;
 }
diff-tree eb9caf083353f3430f786da717b6c56b13f82ecb (from 5e0f46cdebb5e086b344cc09b4537982a07e45cd)
Author: Carl Worth <cworth at cworth.org>
Date:   Fri Jul 28 16:59:54 2006 -0700

    Add -Wsign-compare compiler flag and fix all warnings

diff --git a/configure.in b/configure.in
index 80cdd41..cb2fa23 100644
--- a/configure.in
+++ b/configure.in
@@ -533,7 +533,7 @@ dnl Use lots of warning flags with GCC
 WARN_CFLAGS=""
 
 if test "x$GCC" = "xyes"; then
-	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
+	WARN_CFLAGS="-Wall -Wsign-compare -Wpointer-arith -Wstrict-prototypes \
 	-Wmissing-prototypes -Wmissing-declarations \
 	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
 fi
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 6f454c6..0d547d9 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1349,7 +1349,7 @@ pixman_composite (pixman_operator_t	op,
     Bool	    maskAlphaMap = FALSE;
     Bool	    dstAlphaMap = pDst->alphaMap != 0;
     int		    x_msk, y_msk, x_src, y_src, x_dst, y_dst;
-    int		    w, h, w_this, h_this;
+    unsigned int    w, h, w_this, h_this;
 
 #ifdef USE_MMX
     static Bool mmx_setup = FALSE;
diff --git a/pixman/src/icformat.c b/pixman/src/icformat.c
index 62a171d..946c9fe 100644
--- a/pixman/src/icformat.c
+++ b/pixman/src/icformat.c
@@ -23,7 +23,7 @@
 
 #include "icint.h"
 
-#define Mask(n)	((n) == 32 ? 0xffffffff : ((1 << (n))-1))
+#define Mask(n)	((n) == 32 ? 0xffffffff : (unsigned) ((1 << (n))-1))
 
 pixman_format_t *
 pixman_format_create (pixman_format_name_t name)
@@ -169,11 +169,11 @@ pixman_format_destroy (pixman_format_t *
 
 void
 pixman_format_get_masks (pixman_format_t *format,
-                         int *bpp,
-                         int *alpha_mask,
-                         int *red_mask,
-                         int *green_mask,
-                         int *blue_mask)
+                         unsigned int *bpp,
+                         unsigned int *alpha_mask,
+                         unsigned int *red_mask,
+                         unsigned int *green_mask,
+                         unsigned int *blue_mask)
 {
     *bpp = PICT_FORMAT_BPP (format->format_code);
 
diff --git a/pixman/src/pixman.h b/pixman/src/pixman.h
index ca24e33..173394d 100644
--- a/pixman/src/pixman.h
+++ b/pixman/src/pixman.h
@@ -247,11 +247,11 @@ pixman_format_destroy (pixman_format_t *
 
 void
 pixman_format_get_masks (pixman_format_t *format,
-                         int *bpp,
-                         int *alpha_mask,
-                         int *red_mask,
-                         int *green_mask,
-                         int *blue_mask);
+                         unsigned int *bpp,
+                         unsigned int *alpha_mask,
+                         unsigned int *red_mask,
+                         unsigned int *green_mask,
+                         unsigned int *blue_mask);
 
 /* icimage.c */
 
diff --git a/src/cairo-array.c b/src/cairo-array.c
index baf1765..218f511 100644
--- a/src/cairo-array.c
+++ b/src/cairo-array.c
@@ -159,7 +159,7 @@ _cairo_array_grow_by (cairo_array_t *arr
  * beyond @num_elements are simply "forgotten".
  **/
 void
-_cairo_array_truncate (cairo_array_t *array, int num_elements)
+_cairo_array_truncate (cairo_array_t *array, unsigned int num_elements)
 {
     assert (! array->is_snapshot);
 
@@ -187,7 +187,7 @@ _cairo_array_truncate (cairo_array_t *ar
  *	    ... use values[i] here ...
  **/
 void *
-_cairo_array_index (cairo_array_t *array, int index)
+_cairo_array_index (cairo_array_t *array, unsigned int index)
 {
     /* We allow an index of 0 for the no-elements case.
      * This makes for cleaner calling code which will often look like:
@@ -287,7 +287,7 @@ _cairo_array_append_multiple (cairo_arra
  **/
 cairo_status_t
 _cairo_array_allocate (cairo_array_t	 *array,
-		       int		  num_elements,
+		       unsigned int	  num_elements,
 		       void		**elements)
 {
     cairo_status_t status;
diff --git a/src/cairo-font-subset.c b/src/cairo-font-subset.c
index dc21d14..7e94723 100644
--- a/src/cairo-font-subset.c
+++ b/src/cairo-font-subset.c
@@ -686,7 +686,7 @@ cairo_pdf_ft_font_generate (void *abstra
     cairo_ft_unscaled_font_t *ft_unscaled_font;
     cairo_pdf_ft_font_t *font = abstract_font;
     unsigned long start, end, next, checksum, *checksum_location;
-    int i;
+    unsigned int i;
 
     /* XXX: It would be cleaner to do something besides this cast
      * here. Perhaps cairo_pdf_ft_font_t should just have the
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index f6bd601..1196691 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -494,7 +494,7 @@ _cairo_gstate_get_line_join (cairo_gstat
 cairo_status_t
 _cairo_gstate_set_dash (cairo_gstate_t *gstate, const double *dash, int num_dashes, double offset)
 {
-    int i;
+    unsigned int i;
     double dash_total;
 
     if (gstate->stroke_style.dash)
diff --git a/src/cairo-hash.c b/src/cairo-hash.c
index a9909a2..948cd23 100644
--- a/src/cairo-hash.c
+++ b/src/cairo-hash.c
@@ -115,7 +115,7 @@ static const cairo_hash_table_arrangemen
     { 268435456,	590559793,	590559791	}
 };
 
-#define NUM_HASH_TABLE_ARRANGEMENTS (sizeof(hash_table_arrangements)/sizeof(hash_table_arrangements[0]))
+#define NUM_HASH_TABLE_ARRANGEMENTS ((int)(sizeof(hash_table_arrangements)/sizeof(hash_table_arrangements[0])))
 
 struct _cairo_hash_table {
     cairo_hash_keys_equal_func_t keys_equal;
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 4a8f52b..8aca7bc 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -90,7 +90,7 @@ _cairo_image_surface_create_for_pixman_i
 static cairo_format_t
 _cairo_format_from_pixman_format (pixman_format_t *pixman_format)
 {
-    int bpp, am, rm, gm, bm;
+    unsigned int bpp, am, rm, gm, bm;
 
     pixman_format_get_masks (pixman_format, &bpp, &am, &rm, &gm, &bm);
 
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 96ff8ce..351c6a4 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -184,7 +184,7 @@ _cairo_output_stream_write_hex_string (c
 {
     const char hex_chars[] = "0123456789abcdef";
     char buffer[2];
-    int i, column;
+    unsigned int i, column;
 
     if (stream->status)
 	return;
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 4ba321e..051d068 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -59,7 +59,7 @@ typedef struct cairo_stroker {
     cairo_stroke_face_t first_face;
 
     cairo_bool_t dashed;
-    int dash_index;
+    unsigned int dash_index;
     int dash_on;
     double dash_remain;
 } cairo_stroker_t;
@@ -114,7 +114,7 @@ _cairo_stroker_start_dash (cairo_stroker
 {
     double offset;
     int	on = 1;
-    int	i = 0;
+    unsigned int i = 0;
 
     offset = stroker->style->dash_offset;
 
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 269a3e3..463c0e8 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -591,7 +591,7 @@ _cairo_pattern_add_color_stop (cairo_gra
 {
     pixman_gradient_stop_t *new_stops;
     cairo_fixed_t	   x;
-    int			   i;
+    unsigned int	   i;
 
     new_stops = realloc (pattern->stops, (pattern->n_stops + 1) *
 			 sizeof (pixman_gradient_stop_t));
@@ -1079,7 +1079,7 @@ _cairo_pattern_is_opaque_solid (const ca
 static cairo_bool_t
 _gradient_is_opaque (const cairo_gradient_pattern_t *gradient)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < gradient->n_stops; i++)
 	if (! CAIRO_ALPHA_IS_OPAQUE (gradient->stops[i].color.alpha))
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index aaf71c7..ea436e6 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1081,8 +1081,7 @@ emit_pattern_stops (cairo_pdf_surface_t 
 {
     cairo_pdf_resource_t    function;
     cairo_pdf_color_stop_t *allstops, *stops;
-    unsigned int 	   n_stops;
-    unsigned int 	   i;
+    unsigned int i, n_stops;
 
     function = _cairo_pdf_surface_new_object (surface);
 
@@ -2451,7 +2450,7 @@ _cairo_pdf_surface_emit_stroke_style (ca
 				 _cairo_pdf_line_join (style->line_join));
 
     if (style->num_dashes) {
-	int d;
+	unsigned int d;
 	_cairo_output_stream_printf (surface->output, "[");
 	for (d = 0; d < style->num_dashes; d++)
 	    _cairo_output_stream_printf (surface->output, " %f", style->dash[d]);
@@ -2579,7 +2578,7 @@ _cairo_pdf_surface_show_glyphs (void			*
 				cairo_scaled_font_t	*scaled_font)
 {
     cairo_pdf_surface_t *surface = abstract_surface;
-    int current_subset_id = -1;
+    unsigned int current_subset_id = (unsigned int)-1;
     unsigned int font_id, subset_id, subset_glyph_index;
     cairo_status_t status;
     int i;
diff --git a/src/cairo-png.c b/src/cairo-png.c
index d656016..63966b5 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -43,7 +43,7 @@
 static void
 unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < row_info->rowbytes; i += 4) {
         uint8_t *b = &data[i];
@@ -67,7 +67,7 @@ unpremultiply_data (png_structp png, png
 static void
 convert_data_to_bytes (png_structp png, png_row_infop row_info, png_bytep data)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < row_info->rowbytes; i += 4) {
         uint8_t *b = &data[i];
@@ -301,7 +301,7 @@ premultiply_data (png_structp   png,
                   png_row_infop row_info,
                   png_bytep     data)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < row_info->rowbytes; i += 4) {
 	uint8_t *base = &data[i];
@@ -332,7 +332,7 @@ read_png (png_rw_ptr	read_func,
 {
     cairo_surface_t *surface = (cairo_surface_t*) &_cairo_surface_nil;
     png_byte *data = NULL;
-    int i;
+    unsigned int i;
     png_struct *png = NULL;
     png_info *info;
     png_uint_32 png_width, png_height, stride;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 3856aa2..37394a8 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2056,7 +2056,7 @@ _cairo_ps_surface_show_glyphs (void		   
 {
     cairo_ps_surface_t *surface = abstract_surface;
     cairo_output_stream_t *stream = surface->stream;
-    int current_subset_id = -1;
+    unsigned int current_subset_id = -1;
     unsigned int font_id, subset_id, subset_glyph_index;
     cairo_status_t status;
     int i;
diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index 112925c..0c428e7 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -73,9 +73,9 @@ typedef struct _cairo_sub_font_glyph {
 
 typedef struct _cairo_sub_font_collection {
     unsigned long *glyphs; /* scaled_font_glyph_index */
-    int glyphs_size;
-    int max_glyph;
-    int num_glyphs;
+    unsigned int glyphs_size;
+    unsigned int max_glyph;
+    unsigned int num_glyphs;
 
     unsigned int subset_id;
 
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index d651e01..ac229d0 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -758,7 +758,7 @@ _cairo_scaled_font_text_to_glyphs (cairo
 				   cairo_glyph_t      **glyphs,
 				   int 		       *num_glyphs)
 {
-    size_t i;
+    int i;
     uint32_t *ucs4 = NULL;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_scaled_glyph_t *scaled_glyph;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index b391506..0843e3b 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -898,7 +898,7 @@ emit_meta_surface (cairo_svg_document_t 
     cairo_output_stream_t *contents;
     cairo_meta_surface_t *meta;
     cairo_meta_snapshot_t *snapshot;
-    int num_elements;
+    unsigned int num_elements;
     unsigned int i, id;
 
     num_elements = document->meta_snapshots.num_elements;
@@ -1100,7 +1100,7 @@ emit_pattern_stops (cairo_output_stream_
 		    double start_offset)
 {
     double offset;
-    int i;
+    unsigned int i;
 
     for (i = 0; i < pattern->n_stops; i++) {
 	offset = start_offset + (1 - start_offset ) *
@@ -1602,7 +1602,7 @@ _cairo_svg_surface_intersect_clip_path (
     cairo_svg_surface_t *surface = dst;
     cairo_svg_document_t *document = surface->document;
     cairo_status_t status;
-    int i;
+    unsigned int i;
 
     if (path == NULL) {
  	for (i = 0; i < surface->clip_level; i++)
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 58ad459..7e96e87 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -747,7 +747,7 @@ _draw_image_surface (cairo_xlib_surface_
 		     int                    dst_y)
 {
     XImage ximage;
-    int bpp, alpha, red, green, blue;
+    unsigned int bpp, alpha, red, green, blue;
     int native_byte_order = _native_byte_order_lsb () ? LSBFirst : MSBFirst;
 
     pixman_format_get_masks (pixman_image_get_format (image->pixman_image),
diff --git a/src/cairoint.h b/src/cairoint.h
index f690a9a..fb5d778 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -352,9 +352,9 @@ _cairo_rectangle_intersect (cairo_rectan
 
 typedef struct _cairo_array cairo_array_t;
 struct _cairo_array {
-    int size;
-    int num_elements;
-    int element_size;
+    unsigned int size;
+    unsigned int num_elements;
+    unsigned int element_size;
     char **elements;
 
     cairo_bool_t is_snapshot;
@@ -374,7 +374,7 @@ cairo_private cairo_status_t
 _cairo_array_grow_by (cairo_array_t *array, int additional);
 
 cairo_private void
-_cairo_array_truncate (cairo_array_t *array, int length);
+_cairo_array_truncate (cairo_array_t *array, unsigned int num_elements);
 
 cairo_private cairo_status_t
 _cairo_array_append (cairo_array_t *array, const void *element);
@@ -386,11 +386,11 @@ _cairo_array_append_multiple (cairo_arra
 
 cairo_private cairo_status_t
 _cairo_array_allocate (cairo_array_t	 *array,
-		       int		  num_elements,
+		       unsigned int	  num_elements,
 		       void		**elements);
 
 cairo_private void *
-_cairo_array_index (cairo_array_t *array, int index);
+_cairo_array_index (cairo_array_t *array, unsigned int index);
 
 cairo_private void
 _cairo_array_copy_element (cairo_array_t *array, int index, void *dst);
@@ -620,7 +620,7 @@ typedef struct _cairo_stroke_style {
     cairo_line_join_t	 line_join;
     double		 miter_limit;
     double		*dash;
-    int			 num_dashes;
+    unsigned int	 num_dashes;
     double		 dash_offset;
 } cairo_stroke_style_t;
 
@@ -970,7 +970,7 @@ typedef struct _cairo_gradient_pattern {
     cairo_pattern_t base;
 
     pixman_gradient_stop_t *stops;
-    int			   n_stops;
+    unsigned int	   n_stops;
 } cairo_gradient_pattern_t;
 
 typedef struct _cairo_linear_pattern {
diff-tree 5e0f46cdebb5e086b344cc09b4537982a07e45cd (from 84b37568e1485c461df663f875ba5546b44e5c5c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 28 15:41:11 2006 -0700

    Standardize on unsigned for ref_count type and add CAIRO_REF_COUNT_INVALID
    
    The CAIRO_REF_COUNT_INVALID macro simply hides the ((unsigned int)-1) cast
    to avoid warnings about comparison between signed and unsigned values.

diff --git a/src/cairo-font.c b/src/cairo-font.c
index 5ef8b6c..174d1c7 100644
--- a/src/cairo-font.c
+++ b/src/cairo-font.c
@@ -49,7 +49,7 @@ static const cairo_font_face_backend_t _
 const cairo_font_face_t _cairo_font_face_nil = {
     { 0 },			/* hash_entry */
     CAIRO_STATUS_NO_MEMORY,	/* status */
-    -1,		                /* ref_count */
+    CAIRO_REF_COUNT_INVALID,	/* ref_count */
     { 0, 0, 0, NULL },		/* user_data */
     &_cairo_toy_font_face_backend
 };
@@ -82,7 +82,7 @@ cairo_font_face_reference (cairo_font_fa
     if (font_face == NULL)
 	return NULL;
 
-    if (font_face->ref_count == (unsigned int)-1)
+    if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
 	return font_face;
 
     /* We would normally assert (font_face->ref_count >0) here but we
@@ -108,7 +108,7 @@ cairo_font_face_destroy (cairo_font_face
     if (font_face == NULL)
 	return;
 
-    if (font_face->ref_count == (unsigned int)-1)
+    if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
     assert (font_face->ref_count > 0);
@@ -202,7 +202,7 @@ cairo_font_face_set_user_data (cairo_fon
 			       void			   *user_data,
 			       cairo_destroy_func_t	    destroy)
 {
-    if (font_face->ref_count == -1)
+    if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
 	return CAIRO_STATUS_NO_MEMORY;
 
     return _cairo_user_data_array_set_data (&font_face->user_data,
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 1a62c66..269a3e3 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -31,7 +31,7 @@
 
 const cairo_solid_pattern_t cairo_pattern_nil = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
-      (unsigned int)-1,		/* ref_count */
+      CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_NO_MEMORY,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
@@ -40,7 +40,7 @@ const cairo_solid_pattern_t cairo_patter
 
 static const cairo_solid_pattern_t cairo_pattern_nil_null_pointer = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
-      (unsigned int)-1,		/* ref_count */
+      CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_NULL_POINTER,/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
@@ -49,7 +49,7 @@ static const cairo_solid_pattern_t cairo
 
 static const cairo_solid_pattern_t cairo_pattern_nil_file_not_found = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
-      (unsigned int)-1,		/* ref_count */
+      CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_FILE_NOT_FOUND, /* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
@@ -58,7 +58,7 @@ static const cairo_solid_pattern_t cairo
 
 static const cairo_solid_pattern_t cairo_pattern_nil_read_error = {
     { CAIRO_PATTERN_TYPE_SOLID, 	/* type */
-      (unsigned int)-1,		/* ref_count */
+      CAIRO_REF_COUNT_INVALID,		/* ref_count */
       CAIRO_STATUS_READ_ERROR,	/* status */
       { 1., 0., 0., 1., 0., 0., }, /* matrix */
       CAIRO_FILTER_DEFAULT,	/* filter */
@@ -514,7 +514,7 @@ cairo_pattern_reference (cairo_pattern_t
     if (pattern == NULL)
 	return NULL;
 
-    if (pattern->ref_count == (unsigned int)-1)
+    if (pattern->ref_count == CAIRO_REF_COUNT_INVALID)
 	return pattern;
 
     assert (pattern->ref_count > 0);
@@ -568,7 +568,7 @@ cairo_pattern_destroy (cairo_pattern_t *
     if (pattern == NULL)
 	return;
 
-    if (pattern->ref_count == (unsigned int)-1)
+    if (pattern->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
     assert (pattern->ref_count > 0);
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index a4fe953..d651e01 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -74,7 +74,7 @@ _cairo_scaled_glyph_destroy (void *abstr
 static const cairo_scaled_font_t _cairo_scaled_font_nil = {
     { 0 },			/* hash_entry */
     CAIRO_STATUS_NO_MEMORY,	/* status */
-    -1,				/* ref_count */
+    CAIRO_REF_COUNT_INVALID,	/* ref_count */
     NULL,			/* font_face */
     { 1., 0., 0., 1., 0, 0},	/* font_matrix */
     { 1., 0., 0., 1., 0, 0},	/* ctm */
@@ -510,7 +510,7 @@ cairo_scaled_font_reference (cairo_scale
     if (scaled_font == NULL)
 	return NULL;
 
-    if (scaled_font->ref_count == (unsigned int)-1)
+    if (scaled_font->ref_count == CAIRO_REF_COUNT_INVALID)
 	return scaled_font;
 
     /* We would normally assert (scaled_font->ref_count > 0) here, but
@@ -565,7 +565,7 @@ cairo_scaled_font_destroy (cairo_scaled_
     if (scaled_font == NULL)
 	return;
 
-    if (scaled_font->ref_count == (unsigned int)-1)
+    if (scaled_font->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
     /* cairo_scaled_font_t objects are cached and shared between
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index fb25e07..db47d1e 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -45,7 +45,7 @@ const cairo_surface_t _cairo_surface_nil
     &cairo_image_surface_backend,	/* backend */
     CAIRO_SURFACE_TYPE_IMAGE,
     CAIRO_CONTENT_COLOR,
-    -1,					/* ref_count */
+    CAIRO_REF_COUNT_INVALID,		/* ref_count */
     CAIRO_STATUS_NO_MEMORY,		/* status */
     FALSE,				/* finished */
     { 0,	/* size */
@@ -71,7 +71,7 @@ const cairo_surface_t _cairo_surface_nil
     &cairo_image_surface_backend,	/* backend */
     CAIRO_SURFACE_TYPE_IMAGE,
     CAIRO_CONTENT_COLOR,
-    -1,					/* ref_count */
+    CAIRO_REF_COUNT_INVALID,		/* ref_count */
     CAIRO_STATUS_FILE_NOT_FOUND,	/* status */
     FALSE,				/* finished */
     { 0,	/* size */
@@ -97,7 +97,7 @@ const cairo_surface_t _cairo_surface_nil
     &cairo_image_surface_backend,	/* backend */
     CAIRO_SURFACE_TYPE_IMAGE,
     CAIRO_CONTENT_COLOR,
-    -1,					/* ref_count */
+    CAIRO_REF_COUNT_INVALID,		/* ref_count */
     CAIRO_STATUS_READ_ERROR,		/* status */
     FALSE,				/* finished */
     { 0,	/* size */
@@ -362,7 +362,7 @@ cairo_surface_reference (cairo_surface_t
     if (surface == NULL)
 	return NULL;
 
-    if (surface->ref_count == (unsigned int)-1)
+    if (surface->ref_count == CAIRO_REF_COUNT_INVALID)
 	return surface;
 
     assert (surface->ref_count > 0);
@@ -386,7 +386,7 @@ cairo_surface_destroy (cairo_surface_t *
     if (surface == NULL)
 	return;
 
-    if (surface->ref_count == (unsigned int)-1)
+    if (surface->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
     assert (surface->ref_count > 0);
@@ -495,7 +495,7 @@ cairo_surface_set_user_data (cairo_surfa
 			     void			 *user_data,
 			     cairo_destroy_func_t	 destroy)
 {
-    if (surface->ref_count == -1)
+    if (surface->ref_count == CAIRO_REF_COUNT_INVALID)
 	return CAIRO_STATUS_NO_MEMORY;
 
     return _cairo_user_data_array_set_data (&surface->user_data,
diff --git a/src/cairo.c b/src/cairo.c
index 76f4831..b9d5b6d 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -44,7 +44,7 @@
 #define CAIRO_TOLERANCE_MINIMUM	0.0002 /* We're limited by 16 bits of sub-pixel precision */
 
 static const cairo_t cairo_nil = {
-  (unsigned int)-1,		/* ref_count */
+  CAIRO_REF_COUNT_INVALID,	/* ref_count */
   CAIRO_STATUS_NO_MEMORY,	/* status */
   { 				/* path */
     NULL, NULL,			/* op_buf_head, op_buf_tail */
@@ -223,7 +223,7 @@ cairo_reference (cairo_t *cr)
     if (cr == NULL)
 	return NULL;
 
-    if (cr->ref_count == (unsigned int)-1)
+    if (cr->ref_count == CAIRO_REF_COUNT_INVALID)
 	return cr;
 
     assert (cr->ref_count > 0);
@@ -247,7 +247,7 @@ cairo_destroy (cairo_t *cr)
     if (cr == NULL)
 	return;
 
-    if (cr->ref_count == (unsigned int)-1)
+    if (cr->ref_count == CAIRO_REF_COUNT_INVALID)
 	return;
 
     assert (cr->ref_count > 0);
diff --git a/src/cairoint.h b/src/cairoint.h
index 4eb0c3c..f690a9a 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -192,6 +192,8 @@ do {					\
     assert (NOT_REACHED);		\
 } while (0)
 
+#define CAIRO_REF_COUNT_INVALID ((unsigned int) -1)
+
 #include "cairo-wideint-private.h"
 
 typedef int32_t		cairo_fixed_16_16_t;
@@ -427,7 +429,7 @@ typedef struct _cairo_font_face_backend 
  */
 typedef struct _cairo_unscaled_font {
     cairo_hash_entry_t hash_entry;
-    int ref_count;
+    unsigned int ref_count;
     const cairo_unscaled_font_backend_t *backend;
 } cairo_unscaled_font_t;
 
@@ -457,7 +459,7 @@ struct _cairo_scaled_font {
 
     /* useful bits for _cairo_scaled_font_nil */
     cairo_status_t status;
-    int ref_count;
+    unsigned int ref_count;
 
     /* hash key members */
     cairo_font_face_t *font_face; /* may be NULL */
@@ -486,7 +488,7 @@ struct _cairo_font_face {
     /* hash_entry must be first */
     cairo_hash_entry_t hash_entry;
     cairo_status_t status;
-    int ref_count;
+    unsigned int ref_count;
     cairo_user_data_array_t user_data;
     const cairo_font_face_backend_t *backend;
 };
diff-tree 84b37568e1485c461df663f875ba5546b44e5c5c (from 811f7af1b2cf659b3a3c9b0749c65742207cb946)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 28 15:13:00 2006 -0700

    Add -Wold-style-definition compiler falg and fix all warnings.

diff --git a/configure.in b/configure.in
index 9e48511..80cdd41 100644
--- a/configure.in
+++ b/configure.in
@@ -535,7 +535,7 @@ WARN_CFLAGS=""
 if test "x$GCC" = "xyes"; then
 	WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
 	-Wmissing-prototypes -Wmissing-declarations \
-	-Wnested-externs -fno-strict-aliasing"
+	-Wnested-externs -fno-strict-aliasing -Wold-style-definition"
 fi
 
 AC_SUBST(WARN_CFLAGS)
diff --git a/pixman/src/pixregion.c b/pixman/src/pixregion.c
index aa756ab..c9bc219 100644
--- a/pixman/src/pixregion.c
+++ b/pixman/src/pixregion.c
@@ -988,10 +988,9 @@ pixman_region_intersectO (
 }
 
 pixman_region_status_t
-pixman_region_intersect(newReg, reg1, reg2)
-    pixman_region16_t * 	newReg;     /* destination Region */
-    pixman_region16_t * 	reg1;
-    pixman_region16_t *	reg2;       /* source regions     */
+pixman_region_intersect(pixman_region16_t * 	newReg,
+			pixman_region16_t * 	reg1,
+			pixman_region16_t *	reg2)
 {
     good(reg1);
     good(reg2);
@@ -1257,9 +1256,8 @@ slim_hidden_def(pixman_region_union);
  *
  */
 pixman_region_status_t
-pixman_region_append(dstrgn, rgn)
-    pixman_region16_t * dstrgn;
-    pixman_region16_t * rgn;
+pixman_region_append(pixman_region16_t * dstrgn,
+		     pixman_region16_t * rgn)
 {
     int numRects, dnumRects, size;
     pixman_box16_t *new, *old;
@@ -1442,9 +1440,8 @@ QuickSortRects(
  */
 
 pixman_region_status_t
-pixman_region_validate(badreg, pOverlap)
-    pixman_region16_t * badreg;
-    int *pOverlap;
+pixman_region_validate(pixman_region16_t * badreg,
+		       int *pOverlap)
 {
     /* Descriptor for regions under construction  in Step 2. */
     typedef struct {
@@ -1858,10 +1855,9 @@ pixman_region_subtractO (
  *-----------------------------------------------------------------------
  */
 pixman_region_status_t
-pixman_region_subtract(regD, regM, regS)
-    pixman_region16_t *	regD;
-    pixman_region16_t * 	regM;
-    pixman_region16_t *	regS;
+pixman_region_subtract(pixman_region16_t *	regD,
+		       pixman_region16_t * 	regM,
+		       pixman_region16_t *	regS)
 {
     int overlap; /* result ignored */
 
@@ -1923,10 +1919,9 @@ pixman_region_subtract(regD, regM, regS)
  *-----------------------------------------------------------------------
  */
 pixman_region_status_t
-pixman_region_inverse(newReg, reg1, invRect)
-    pixman_region16_t * 	  newReg;       /* Destination region */
-    pixman_region16_t * 	  reg1;         /* Region to invert */
-    pixman_box16_t *     	  invRect; 	/* Bounding box for inversion */
+pixman_region_inverse(pixman_region16_t * 	  newReg,       /* Destination region */
+		      pixman_region16_t * 	  reg1,         /* Region to invert */
+		      pixman_box16_t *     	  invRect) 	/* Bounding box for inversion */
 {
     pixman_region16_t	  invReg;   	/* Quick and dirty region made from the
 				 * bounding box */
@@ -1983,9 +1978,8 @@ pixman_region_inverse(newReg, reg1, invR
  */
 
 int
-pixman_region_contains_rectangle(region, prect)
-    pixman_region16_t *  region;
-    pixman_box16_t *     prect;
+pixman_region_contains_rectangle(pixman_region16_t *  region,
+				 pixman_box16_t *     prect)
 {
     int	x;
     int	y;
@@ -2200,11 +2194,11 @@ pixman_region_reset(pixman_region16_t *r
     region->data = (pixman_region16_data_t *)NULL;
 }
 
+/* box is "return" value */
 int
-pixman_region_contains_point(region, x, y, box)
-    pixman_region16_t * region;
-    int x, y;
-    pixman_box16_t * box;     /* "return" value */
+pixman_region_contains_point(pixman_region16_t * region,
+			     int x, int y,
+			     pixman_box16_t * box)
 {
     pixman_box16_t *pbox, *pboxEnd;
     int numRects;
@@ -2235,8 +2229,7 @@ pixman_region_contains_point(region, x, 
 }
 
 int
-pixman_region_not_empty(region)
-    pixman_region16_t * region;
+pixman_region_not_empty(pixman_region16_t * region)
 {
     good(region);
     return(!PIXREGION_NIL(region));
@@ -2252,8 +2245,7 @@ pixman_region16_broken(pixman_region16_t
 */
 
 void
-pixman_region_empty(region)
-    pixman_region16_t * region;
+pixman_region_empty(pixman_region16_t * region)
 {
     good(region);
     freeData(region);
@@ -2263,8 +2255,7 @@ pixman_region_empty(region)
 }
 
 pixman_box16_t *
-pixman_region_extents(region)
-    pixman_region16_t * region;
+pixman_region_extents(pixman_region16_t * region)
 {
     good(region);
     return(&region->extents);


More information about the cairo-commit mailing list