summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-08-08 01:16:49 -0700
committerCarl Worth <cworth@cworth.org>2006-08-08 01:16:49 -0700
commitc3b912d7db34c5881cf14725b7d29266cbf24877 (patch)
tree84188088e73c7caf74ffd2f80bb032739eeb491c /test
parentc7d11ad2b4778cb7399eae990a410cb72568af11 (diff)
Eliminate most compiler warnings from the test suite
Diffstat (limited to 'test')
-rw-r--r--test/bitmap-font.c2
-rw-r--r--test/buffer-diff.c2
-rw-r--r--test/cairo-test.c16
-rw-r--r--test/cairo-test.h3
-rw-r--r--test/clip-operator.c2
-rw-r--r--test/create-for-stream.c4
-rw-r--r--test/degenerate-path.c2
-rw-r--r--test/fallback-resolution.c2
-rw-r--r--test/mask.c2
-rw-r--r--test/multi-page.c2
-rw-r--r--test/operator-clear.c2
-rw-r--r--test/operator-source.c2
-rw-r--r--test/pdf-features.c4
-rw-r--r--test/ps-features.c4
-rw-r--r--test/push-group.c1
-rw-r--r--test/read-png.c4
-rw-r--r--test/svg-surface.c2
-rw-r--r--test/trap-clip.c2
-rw-r--r--test/unbounded-operator.c2
-rw-r--r--test/write-png.c2
20 files changed, 35 insertions, 27 deletions
diff --git a/test/bitmap-font.c b/test/bitmap-font.c
index bf8f109e1..16ad52ca5 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 0244ecd02..5463c2987 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 dee30a941..eb358d824 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -104,13 +104,13 @@ static const char *fail_face = "", *normal_face = "";
/* 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_t 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_surface_t *surface,
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_name_t formatname,
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 (const char *test_name,
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 3694f35d8..8402d13a4 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 4d262f855..631a59d73 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 b2137cec6..cbe820048 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 ab6a34d75..964500fc4 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 3d4b4921c..25cdcdc4d 100644
--- a/test/fallback-resolution.c
+++ b/test/fallback-resolution.c
@@ -85,7 +85,7 @@ static const char *backend_filename[NUM_BACKENDS] = {
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 ed328199e..84ebf386e 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 05230c795..86cf188bb 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 ea9fcf8fc..74d767bb3 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 4bea7935e..662df5b5a 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 a46500f09..f79049972 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 331aa539d..e2882ffec 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 738df6f18..0c6e50b6f 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 f5d80b5c1..bb02e50b9 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 *filename,
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 305227c52..355394c6d 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 a1483de09..3737e5a3d 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 d3a6f3542..5e01acd19 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 83ba2b5c4..c906df5fa 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];