]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Squash warnings
authorJohn Mark Bell <jmb@netsurf-browser.org>
Mon, 24 Aug 2009 08:21:22 +0000 (08:21 -0000)
committerJohn Mark Bell <jmb@netsurf-browser.org>
Mon, 24 Aug 2009 08:21:22 +0000 (08:21 -0000)
svn path=/trunk/libsvgtiny/; revision=9423

src/svgtiny.c
src/svgtiny_gradient.c
src/svgtiny_internal.h

index ab6b6dd5ea30f282320fa33bcccd5fff437a5be3..56f0028ccecc315ec3211f7dc275907a5adc4374 100644 (file)
@@ -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(
index be4f2565cceee90cae88e6d56176d5a5ba14ea52..98a2964702cbccee1fbb76c2176709023e0cb1c2 100644 (file)
@@ -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 {
index f07f4308a181420b42d2c2e50a99c773d7997202..3ea6e7b49d511b7ece2145bb81870156158b492a 100644 (file)
 
 #include <stdbool.h>
 
+#ifndef UNUSED
+#define UNUSED(x) ((void) (x))
+#endif
+
 struct svgtiny_gradient_stop {
        float offset;
        svgtiny_colour color;