From 1e4fbffc36f3c7dc959936e3049b0ad8d5dde4d1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 24 Aug 2009 08:21:22 +0000 Subject: [PATCH] Squash warnings svn path=/trunk/libsvgtiny/; revision=9423 --- src/svgtiny.c | 6 +++++- src/svgtiny_gradient.c | 7 ++++--- src/svgtiny_internal.h | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/svgtiny.c b/src/svgtiny.c index ab6b6dd..56f0028 100644 --- a/src/svgtiny.c +++ b/src/svgtiny.c @@ -709,6 +709,8 @@ float svgtiny_parse_length(const char *s, int viewport_size, float n = atof((const char *) s); float font_size = 20; /*css_len2px(&state.style.font_size.value.length, 0);*/ + UNUSED(state); + if (unit[0] == 0) { return n; } else if (unit[0] == '%') { @@ -807,7 +809,7 @@ void svgtiny_parse_color(const char *s, svgtiny_colour *c, } else if (10 <= len && s[0] == 'r' && s[1] == 'g' && s[2] == 'b' && s[3] == '(' && s[len - 1] == ')') { - if (sscanf(s + 4, "%i,%i,%i", &r, &g, &b) == 3) + if (sscanf(s + 4, "%u,%u,%u", &r, &g, &b) == 3) *c = svgtiny_RGB(r, g, b); else if (sscanf(s + 4, "%f%%,%f%%,%f%%", &rf, &gf, &bf) == 3) { b = bf * 255 / 100; @@ -856,6 +858,8 @@ void svgtiny_parse_color(const char *s, svgtiny_colour *c, void svgtiny_parse_font_attributes(const xmlNode *node, struct svgtiny_parse_state *state) { + UNUSED(state); + for (const xmlAttr *attr = node->properties; attr; attr = attr->next) { if (strcmp((const char *) attr->name, "font-size") == 0) { /*if (css_parse_length( diff --git a/src/svgtiny_gradient.c b/src/svgtiny_gradient.c index be4f256..98a2964 100644 --- a/src/svgtiny_gradient.c +++ b/src/svgtiny_gradient.c @@ -45,7 +45,7 @@ void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state) xmlNode *gradient = svgtiny_find_element_by_id( (xmlNode *) state->document, id); - fprintf(stderr, "gradient %p\n", gradient); + fprintf(stderr, "gradient %p\n", (void *) gradient); if (!gradient) { fprintf(stderr, "gradient \"%s\" not found\n", id); return; @@ -280,9 +280,10 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n, /* compute points on the path for triangle vertices */ /* r, r0, r1 are distance along gradient vector */ unsigned int steps = 10; - float x0, y0, x0_trans, y0_trans, r0; /* segment start point */ + float x0 = 0, y0 = 0, x0_trans, y0_trans, r0; /* segment start point */ float x1, y1, x1_trans, y1_trans, r1; /* segment end point */ - float c0x, c0y, c1x, c1y; /* segment control points (beziers only) */ + /* segment control points (beziers only) */ + float c0x = 0, c0y = 0, c1x = 0, c1y = 0; float gradient_norm_squared = gradient_dx * gradient_dx + gradient_dy * gradient_dy; struct grad_point { diff --git a/src/svgtiny_internal.h b/src/svgtiny_internal.h index f07f430..3ea6e7b 100644 --- a/src/svgtiny_internal.h +++ b/src/svgtiny_internal.h @@ -10,6 +10,10 @@ #include +#ifndef UNUSED +#define UNUSED(x) ((void) (x)) +#endif + struct svgtiny_gradient_stop { float offset; svgtiny_colour color; -- 2.44.2