mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-29 08:10:51 +02:00
Eliminate most compiler warnings from the test suite
This commit is contained in:
parent
c7d11ad2b4
commit
c3b912d7db
21 changed files with 36 additions and 28 deletions
|
|
@ -176,7 +176,7 @@ _cairo_paginated_surface_create_image_surface (void *abstract_surface,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ main (void)
|
|||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_status_t status;
|
||||
char *filename;
|
||||
const char *filename;
|
||||
|
||||
cairo_test_init ("multi-page");
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue