[cairo-commit] src/cairo-paginated-surface.c test/bitmap-font.c test/buffer-diff.c test/cairo-test.c test/cairo-test.h test/clip-operator.c test/create-for-stream.c test/degenerate-path.c test/fallback-resolution.c test/mask.c test/multi-page.c test/operator-clear.c test/operator-source.c test/pdf-features.c test/ps-features.c test/push-group.c test/read-png.c test/svg-surface.c test/trap-clip.c test/unbounded-operator.c test/write-png.c

Carl Worth cworth at kemper.freedesktop.org
Tue Aug 8 01:24:50 PDT 2006


 src/cairo-paginated-surface.c |    2 +-
 test/bitmap-font.c            |    2 +-
 test/buffer-diff.c            |    2 +-
 test/cairo-test.c             |   16 ++++++++++------
 test/cairo-test.h             |    3 ++-
 test/clip-operator.c          |    2 +-
 test/create-for-stream.c      |    4 +++-
 test/degenerate-path.c        |    2 +-
 test/fallback-resolution.c    |    2 +-
 test/mask.c                   |    2 +-
 test/multi-page.c             |    2 +-
 test/operator-clear.c         |    2 +-
 test/operator-source.c        |    2 +-
 test/pdf-features.c           |    4 ++--
 test/ps-features.c            |    4 ++--
 test/push-group.c             |    1 -
 test/read-png.c               |    4 ++--
 test/svg-surface.c            |    2 ++
 test/trap-clip.c              |    2 +-
 test/unbounded-operator.c     |    2 +-
 test/write-png.c              |    2 +-
 21 files changed, 36 insertions(+), 28 deletions(-)

New commits:
diff-tree c3b912d7db34c5881cf14725b7d29266cbf24877 (from c7d11ad2b4778cb7399eae990a410cb72568af11)
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Aug 8 01:16:49 2006 -0700

    Eliminate most compiler warnings from the test suite

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 79b3956..d497778 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -176,7 +176,7 @@ _cairo_paginated_surface_create_image_su
 						      width,
 						      height);
 
-    cairo_surface_get_font_options (surface, &options);
+    cairo_surface_get_font_options (&surface->base, &options);
     _cairo_surface_set_font_options (image, &options);
 
     return image;
diff --git a/test/bitmap-font.c b/test/bitmap-font.c
index bf8f109..16ad52c 100644
--- a/test/bitmap-font.c
+++ b/test/bitmap-font.c
@@ -50,7 +50,7 @@ draw (cairo_t *cr, int width, int height
     FcPattern *pattern;
     cairo_font_face_t *font_face;
     cairo_status_t status;
-    char *srcdir = getenv ("srcdir");
+    const char *srcdir = getenv ("srcdir");
     char *filename;
     struct stat stat_buf;
 
diff --git a/test/buffer-diff.c b/test/buffer-diff.c
index 0244ecd..5463c29 100644
--- a/test/buffer-diff.c
+++ b/test/buffer-diff.c
@@ -92,7 +92,7 @@ buffer_diff_core (unsigned char *_buf_a,
 		for (channel = 0; channel < 4; channel++) {
 		    unsigned char value_a = (row_a[x] >> (channel*8));
 		    unsigned char value_b = (row_b[x] >> (channel*8));
-		    unsigned char diff;
+		    unsigned int diff;
 		    diff = value_a - value_b;
 		    diff *= 4; /* emphasize */
 		    if (diff > 255)
diff --git a/test/cairo-test.c b/test/cairo-test.c
index dee30a9..eb358d8 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -104,13 +104,13 @@ static const char *fail_face = "", *norm
 
 /* A fake format we use for the flattened ARGB output of the PS and
  * PDF surfaces. */
-#define CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED -1
+#define CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED ((unsigned int) -1)
 
 /* Static data is messy, but we're coding for tests here, not a
  * general-purpose library, and it keeps the tests cleaner to avoid a
  * context object there, (though not a whole lot). */
 FILE *cairo_test_log_file = NULL;
-char *srcdir;
+const char *srcdir;
 
 /* Used to catch crashes in a test, such that we report it as such and
  * continue testing, although one crasher may already have corrupted memory in
@@ -230,6 +230,7 @@ _cairo_test_content_name (cairo_content_
     case CAIRO_CONTENT_COLOR_ALPHA:
     case CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED:
 	return "argb32";
+    case CAIRO_CONTENT_ALPHA:
     default:
 	assert (0); /* not reached */
 	return "---";
@@ -347,6 +348,7 @@ test_paginated_write_to_png (cairo_surfa
     case CAIRO_CONTENT_COLOR_ALPHA:
 	format = CAIRO_FORMAT_ARGB32;
 	break;
+    case CAIRO_CONTENT_ALPHA:
     default:
 	assert (0); /* not reached */
 	return CAIRO_STATUS_NO_MEMORY;
@@ -511,7 +513,7 @@ create_glitz_glx_surface (glitz_format_n
 static cairo_surface_t *
 create_cairo_glitz_glx_surface (cairo_test_t   *test,
 				cairo_content_t content,
-				void          **closure)
+				void    **closure)
 {
     int width = test->width;
     int height = test->height;
@@ -1108,6 +1110,7 @@ create_xlib_surface (cairo_test_t	 *test
     case CAIRO_CONTENT_COLOR:
 	xrender_format = XRenderFindStandardFormat (dpy, PictStandardRGB24);
 	break;
+    case CAIRO_CONTENT_ALPHA:
     default:
 	cairo_test_log ("Invalid content for xlib test: %d\n", content);
 	return NULL;
@@ -1470,7 +1473,7 @@ cleanup_svg (void *closure)
 }
 #endif /* CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE */
 
-const char *
+static char *
 cairo_ref_name_for_test_target_format (const char *test_name,
 				       const char *target_name,
 				       const char *format)
@@ -1521,6 +1524,7 @@ cairo_ref_name_for_test_target_format (c
     cairo_test_log ("Error: Cannot find reference image for %s/%s-%s-%s%s\n",srcdir,
 		    test_name,
 		    target_name,
+		    format,
 		    CAIRO_TEST_REF_SUFFIX);
 
 done:
@@ -1528,7 +1532,7 @@ done:
 }
 
 static cairo_test_status_t
-cairo_test_for_target (cairo_test_t *test,
+cairo_test_for_target (cairo_test_t		 *test,
 		       cairo_test_target_t	 *target,
 		       int			  dev_offset)
 {
@@ -1691,7 +1695,7 @@ cairo_test_expecting (cairo_test_t *test
 {
     /* we use volatile here to make sure values are not clobbered
      * by longjmp */
-    volatile int i, j, num_targets;
+    volatile size_t i, j, num_targets;
     volatile cairo_bool_t limited_targets = FALSE, print_fail_on_stdout = TRUE;
     const char *tname;
     void (*old_segfault_handler)(int);
diff --git a/test/cairo-test.h b/test/cairo-test.h
index 3694f35..8402d13 100644
--- a/test/cairo-test.h
+++ b/test/cairo-test.h
@@ -30,6 +30,7 @@
 #include "config.h"
 #endif
 
+#include <stdio.h>
 #include <math.h>
 #include <cairo.h>
 
@@ -135,7 +136,7 @@ cairo_status_t
 cairo_test_paint_checkered (cairo_t *cr);
 
 void
-xasprintf (char **strp, const char *fmt, ...);
+xasprintf (char **strp, const char *fmt, ...) CAIRO_PRINTF_FORMAT(2, 3);
 
 CAIRO_END_DECLS
 
diff --git a/test/clip-operator.c b/test/clip-operator.c
index 4d262f8..631a59d 100644
--- a/test/clip-operator.c
+++ b/test/clip-operator.c
@@ -142,7 +142,7 @@ cairo_test_t test = {
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    int j, x, y;
+    size_t j, x, y;
     cairo_operator_t op;
     cairo_pattern_t *pattern;
 
diff --git a/test/create-for-stream.c b/test/create-for-stream.c
index b2137ce..cbe8200 100644
--- a/test/create-for-stream.c
+++ b/test/create-for-stream.c
@@ -68,6 +68,8 @@ draw (cairo_t *cr, int width, int height
     cairo_fill (cr);
 
     cairo_show_page (cr);
+
+    return CAIRO_TEST_SUCCESS;
 }
 
 static void
@@ -84,7 +86,7 @@ draw_to (cairo_surface_t *surface)
 
 typedef struct _write_closure {
     char buffer[MAX_OUTPUT_SIZE];
-    int index;
+    size_t index;
     cairo_test_status_t status;
 } write_closure_t;
 
diff --git a/test/degenerate-path.c b/test/degenerate-path.c
index ab6a34d..964500f 100644
--- a/test/degenerate-path.c
+++ b/test/degenerate-path.c
@@ -43,7 +43,7 @@ static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
     const cairo_line_cap_t cap[] = { CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE, CAIRO_LINE_CAP_BUTT };
-    int i;
+    size_t i;
 
     cairo_set_source_rgb (cr, 1, 0, 0);
 
diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c
index 3d4b492..25cdcdc 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -85,7 +85,7 @@ static const char *backend_filename[NUM_
 int
 main (void)
 {
-    cairo_surface_t *surface;
+    cairo_surface_t *surface = NULL;
     cairo_t *cr;
     cairo_status_t status;
     double ppi[] = { 600., 300., 150., 75., 37.5 };
diff --git a/test/mask.c b/test/mask.c
index ed32819..84ebf38 100644
--- a/test/mask.c
+++ b/test/mask.c
@@ -193,7 +193,7 @@ draw (cairo_t *cr, int width, int height
 {
     cairo_surface_t *tmp_surface;
     cairo_pattern_t *tmp_pattern;
-    int i, j, k;
+    size_t i, j, k;
     cairo_t *cr2;
 
     /* Some of our drawing is unbounded, so we draw each test to
diff --git a/test/multi-page.c b/test/multi-page.c
index 05230c7..86cf188 100644
--- a/test/multi-page.c
+++ b/test/multi-page.c
@@ -132,7 +132,7 @@ main (void)
 {
     cairo_surface_t *surface;
     cairo_status_t status;
-    char *filename;
+    const char *filename;
 
     cairo_test_init ("multi-page");
 
diff --git a/test/operator-clear.c b/test/operator-clear.c
index ea9fcf8..74d767b 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -158,7 +158,7 @@ cairo_test_t test = {
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    int i, j, x, y;
+    size_t i, j, x, y;
     cairo_pattern_t *pattern;
 
     cairo_select_font_face (cr, "Bitstream Vera Sans",
diff --git a/test/operator-source.c b/test/operator-source.c
index 4bea793..662df5b 100644
--- a/test/operator-source.c
+++ b/test/operator-source.c
@@ -197,7 +197,7 @@ cairo_test_t test = {
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    int i, j, x, y;
+    size_t i, j, x, y;
     cairo_pattern_t *pattern;
 
     cairo_select_font_face (cr, "Bitstream Vera Sans",
diff --git a/test/pdf-features.c b/test/pdf-features.c
index a46500f..f790499 100644
--- a/test/pdf-features.c
+++ b/test/pdf-features.c
@@ -92,8 +92,8 @@ main (void)
     cairo_surface_t *surface;
     cairo_t *cr;
     cairo_status_t status;
-    char *filename;
-    int i;
+    const char *filename;
+    size_t i;
 
     cairo_test_init ("pdf-features");
 
diff --git a/test/ps-features.c b/test/ps-features.c
index 331aa53..e2882ff 100644
--- a/test/ps-features.c
+++ b/test/ps-features.c
@@ -95,8 +95,8 @@ main (void)
     cairo_surface_t *surface;
     cairo_t *cr;
     cairo_status_t status;
-    char *filename;
-    int i;
+    const char *filename;
+    size_t i;
     char dsc[255];
 
     cairo_test_init ("ps-features");
diff --git a/test/push-group.c b/test/push-group.c
index 738df6f..0c6e50b 100644
--- a/test/push-group.c
+++ b/test/push-group.c
@@ -56,7 +56,6 @@ draw (cairo_t *cr, int width, int height
         for (i = 0; i < 1; i++) {
             double x = (i * UNIT_SIZE) + (i + 1) * PAD;
             double y = (j * UNIT_SIZE) + (j + 1) * PAD;
-            cairo_pattern_t *group_pattern;
 
             cairo_save (cr);
 
diff --git a/test/read-png.c b/test/read-png.c
index f5d80b5..bb02e50 100644
--- a/test/read-png.c
+++ b/test/read-png.c
@@ -64,7 +64,7 @@ premultiply_data (png_structp   png,
                   png_row_infop row_info,
                   png_bytep     data)
 {
-    int i;
+    size_t i;
 
     for (i = 0; i < row_info->rowbytes; i += 4) {
 	uint8_t *base = &data[i];
@@ -89,7 +89,7 @@ read_png_argb32 (const char         *fil
 		 unsigned int       *height,
 		 unsigned int	    *stride)
 {
-    int i;
+    size_t i;
     FILE *file;
 #define PNG_SIG_SIZE 8
     unsigned char png_sig[PNG_SIG_SIZE];
diff --git a/test/svg-surface.c b/test/svg-surface.c
index 305227c..355394c 100644
--- a/test/svg-surface.c
+++ b/test/svg-surface.c
@@ -82,6 +82,8 @@ draw (cairo_t *cr, int width, int height
 		    0.6, 0.8,
 		    0.7, 0.7);
     cairo_stroke (cr);
+
+    return CAIRO_TEST_SUCCESS;
 }
 
 int
diff --git a/test/trap-clip.c b/test/trap-clip.c
index a1483de..3737e5a 100644
--- a/test/trap-clip.c
+++ b/test/trap-clip.c
@@ -176,7 +176,7 @@ cairo_test_t test = {
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    int i, j, k, x, y;
+    size_t i, j, k, x, y;
 
     for (k = 0; k < ARRAY_SIZE (clip_funcs); k++) {
 	for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) {
diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c
index d3a6f35..5e01acd 100644
--- a/test/unbounded-operator.c
+++ b/test/unbounded-operator.c
@@ -144,7 +144,7 @@ cairo_test_t test = {
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    int i, j, x, y;
+    size_t i, j, x, y;
     cairo_pattern_t *pattern;
 
     cairo_select_font_face (cr, "Bitstream Vera Sans",
diff --git a/test/write-png.c b/test/write-png.c
index 83ba2b5..c906df5 100644
--- a/test/write-png.c
+++ b/test/write-png.c
@@ -34,7 +34,7 @@
 static void
 unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data)
 {
-    int i;
+    size_t i;
 
     for (i = 0; i < row_info->rowbytes; i += 4) {
         unsigned char *b = &data[i];


More information about the cairo-commit mailing list