From 39eb450e2f1b09e50ac0a28c6d3b7e1966e773d1 Mon Sep 17 00:00:00 2001 From: Ravi Nanjundappa Date: Tue, 6 May 2014 14:54:25 +0530 Subject: [PATCH] src : Fix warn_unused_result warnings from gcc Assign the return value to a local variable and then `(void) varname;` to avoid "unused" warning reported by gcc. Signed-off-by: Ravi Nanjundappa Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58727 --- src/cairo-path-stroke-polygon.c | 20 ++++++++++++++------ src/cairo-polygon-intersect.c | 12 ++++++++---- src/cairo-polygon-reduce.c | 6 ++++-- src/cairo-rectangular-scan-converter.c | 4 +++- src/cairo-surface-observer.c | 4 +++- src/cairo-type1-subset.c | 5 ++++- 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c index 2c8fe5e..4138461 100644 --- a/src/cairo-path-stroke-polygon.c +++ b/src/cairo-path-stroke-polygon.c @@ -921,6 +921,8 @@ compute_face (const cairo_point_t *point, static void add_caps (struct stroker *stroker) { + int unused = 0; + /* check for a degenerative sub_path */ if (stroker->has_initial_sub_path && ! stroker->has_first_face && @@ -941,7 +943,8 @@ add_caps (struct stroker *stroker) _cairo_contour_add_point (&stroker->ccw.contour, _cairo_contour_first_point (&stroker->ccw.contour)); - _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + (void) unused; _cairo_contour_reset (&stroker->ccw.contour); } else { if (stroker->has_current_face) @@ -958,7 +961,8 @@ add_caps (struct stroker *stroker) } #endif - _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + (void) unused; _cairo_contour_reset (&stroker->ccw.contour); if (stroker->has_first_face) { @@ -973,12 +977,14 @@ add_caps (struct stroker *stroker) } #endif - _cairo_polygon_add_contour (stroker->polygon, + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + (void) unused; _cairo_contour_reset (&stroker->ccw.contour); } - _cairo_polygon_add_contour (stroker->polygon, &stroker->cw.contour); + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->cw.contour); + (void) unused; _cairo_contour_reset (&stroker->cw.contour); } } @@ -1206,6 +1212,7 @@ close_path (void *closure) { struct stroker *stroker = closure; cairo_status_t status; + int unused = 0; status = line_to (stroker, &stroker->first_point); if (unlikely (status)) @@ -1223,8 +1230,9 @@ close_path (void *closure) *_cairo_contour_last_point (&stroker->cw.contour); #endif - _cairo_polygon_add_contour (stroker->polygon, &stroker->cw.contour); - _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->cw.contour); + unused = _cairo_polygon_add_contour (stroker->polygon, &stroker->ccw.contour); + (void) unused; #if DEBUG { diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c index 2cd73d2..20e0d44 100644 --- a/src/cairo-polygon-intersect.c +++ b/src/cairo-polygon-intersect.c @@ -1156,11 +1156,13 @@ edges_end (cairo_bo_edge_t *left, { cairo_bo_deferred_t *l = &left->deferred; cairo_bo_edge_t *right = l->other; + int unused = 0; assert(right->deferred.other == NULL); if (likely (l->top < bot)) { - _cairo_polygon_add_line (polygon, &left->edge.line, l->top, bot, 1); - _cairo_polygon_add_line (polygon, &right->edge.line, l->top, bot, -1); + unused = _cairo_polygon_add_line (polygon, &left->edge.line, l->top, bot, 1); + unused = _cairo_polygon_add_line (polygon, &right->edge.line, l->top, bot, -1); + (void) unused; } l->other = NULL; @@ -1511,15 +1513,17 @@ _cairo_polygon_intersect_with_boxes (cairo_polygon_t *polygon, boxes[n].p1.y < polygon->extents.p2.y) { cairo_point_t p1, p2; + int unused = 0; p1.y = boxes[n].p1.y; p2.y = boxes[n].p2.y; p2.x = p1.x = boxes[n].p1.x; - _cairo_polygon_add_external_edge (&b, &p1, &p2); + unused = _cairo_polygon_add_external_edge (&b, &p1, &p2); p2.x = p1.x = boxes[n].p2.x; - _cairo_polygon_add_external_edge (&b, &p2, &p1); + unused = _cairo_polygon_add_external_edge (&b, &p2, &p1); + (void) unused; } } diff --git a/src/cairo-polygon-reduce.c b/src/cairo-polygon-reduce.c index ea457fe..4854567 100644 --- a/src/cairo-polygon-reduce.c +++ b/src/cairo-polygon-reduce.c @@ -1158,16 +1158,18 @@ _cairo_bo_edge_end (cairo_bo_edge_t *left, cairo_polygon_t *polygon) { cairo_bo_deferred_t *d = &left->deferred; + int unused = 0; if (likely (d->top < bot)) { - _cairo_polygon_add_line (polygon, + unused = _cairo_polygon_add_line (polygon, &left->edge.line, d->top, bot, 1); - _cairo_polygon_add_line (polygon, + unused = _cairo_polygon_add_line (polygon, &d->right->edge.line, d->top, bot, -1); + (void) unused; } d->right = NULL; diff --git a/src/cairo-rectangular-scan-converter.c b/src/cairo-rectangular-scan-converter.c index e353b34..c81fc0b 100644 --- a/src/cairo-rectangular-scan-converter.c +++ b/src/cairo-rectangular-scan-converter.c @@ -589,6 +589,7 @@ static void generate_row(cairo_span_renderer_t *renderer, { cairo_half_open_span_t spans[4]; unsigned int num_spans = 0; + int unused = 0; int x1 = _cairo_fixed_integer_part (r->left); int x2 = _cairo_fixed_integer_part (r->right); if (x2 > x1) { @@ -622,7 +623,8 @@ static void generate_row(cairo_span_renderer_t *renderer, spans[num_spans].coverage = 0; num_spans++; - renderer->render_rows (renderer, y, h, spans, num_spans); + unused = renderer->render_rows (renderer, y, h, spans, num_spans); + (void) unused; } static cairo_status_t diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c index 6721bf5..9570f9c 100644 --- a/src/cairo-surface-observer.c +++ b/src/cairo-surface-observer.c @@ -656,15 +656,17 @@ static void sync (cairo_surface_t *target, int x, int y) { cairo_rectangle_int_t extents; + int unused = 0; extents.x = x; extents.y = y; extents.width = 1; extents.height = 1; - _cairo_surface_unmap_image (target, + unused = _cairo_surface_unmap_image (target, _cairo_surface_map_to_image (target, &extents)); + (void) unused; } static void diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index 47d85b2..2ebfd7a 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -1260,6 +1260,7 @@ cairo_type1_font_subset_write_private_dict (cairo_type1_font_subset_t *font, const cairo_scaled_font_backend_t *backend; unsigned int i; int glyph, j; + int unused = 0; /* The private dict holds hint information, common subroutines and * the actual glyph definitions (charstrings). @@ -1356,7 +1357,9 @@ skip_subrs: /* Scan past /CharStrings and the integer following it. */ p = charstrings + strlen ("/CharStrings"); - strtol (p, &glyph_count_end, 10); + unused = strtol (p, &glyph_count_end, 10); + (void) unused; + if (p == glyph_count_end) return CAIRO_INT_STATUS_UNSUPPORTED; -- 1.7.9.5