diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2021-08-17 06:25:29 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2021-08-22 12:07:36 +0930 |
commit | 78d267ee7af3c7cabdef437cd6a670111fc6062b (patch) | |
tree | 09f1667fdba4dbc4725fb0513b03802a1dad1613 | |
parent | ba3823e6b82c76bfe962f570dbf48e7c6a8126a6 (diff) | |
download | cairo-78d267ee7af3c7cabdef437cd6a670111fc6062b.tar.gz |
Fix some warnings
-rw-r--r-- | perf/cairo-perf-graph-widget.c | 2 | ||||
-rw-r--r-- | src/cairo-cff-subset.c | 6 | ||||
-rw-r--r-- | src/cairo-svg-surface.c | 27 | ||||
-rw-r--r-- | src/cairo-type1-subset.c | 2 | ||||
-rw-r--r-- | src/cairo-user-font.c | 6 | ||||
-rw-r--r-- | test/cairo-test-trace.c | 6 | ||||
-rw-r--r-- | test/operator-www.c | 4 |
7 files changed, 25 insertions, 28 deletions
diff --git a/perf/cairo-perf-graph-widget.c b/perf/cairo-perf-graph-widget.c index 41311f7ee..e56eee1bc 100644 --- a/perf/cairo-perf-graph-widget.c +++ b/perf/cairo-perf-graph-widget.c @@ -489,8 +489,6 @@ static gboolean graph_view_button_release (GtkWidget *w, GdkEventButton *ev) { - GraphView *self = (GraphView *) w; - return FALSE; } diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c index 2b713410e..4bf22e2b7 100644 --- a/src/cairo-cff-subset.c +++ b/src/cairo-cff-subset.c @@ -1599,7 +1599,7 @@ cairo_cff_parse_charstring (cairo_cff_font_t *font, if (font->is_cid) { fd = font->fdselect[glyph_id]; sub_num = font->type2_stack_top_value + font->fd_local_sub_bias[fd]; - if (sub_num >= _cairo_array_num_elements(&font->fd_local_sub_index[fd])) + if (sub_num >= (int)_cairo_array_num_elements(&font->fd_local_sub_index[fd])) return CAIRO_INT_STATUS_UNSUPPORTED; element = _cairo_array_index (&font->fd_local_sub_index[fd], sub_num); if (! font->fd_local_subs_used[fd][sub_num]) { @@ -1608,7 +1608,7 @@ cairo_cff_parse_charstring (cairo_cff_font_t *font, } } else { sub_num = font->type2_stack_top_value + font->local_sub_bias; - if (sub_num >= _cairo_array_num_elements(&font->local_sub_index)) + if (sub_num >= (int)_cairo_array_num_elements(&font->local_sub_index)) return CAIRO_INT_STATUS_UNSUPPORTED; element = _cairo_array_index (&font->local_sub_index, sub_num); if (! font->local_subs_used[sub_num] || @@ -1634,7 +1634,7 @@ cairo_cff_parse_charstring (cairo_cff_font_t *font, font->type2_seen_first_int = FALSE; sub_num = font->type2_stack_top_value + font->global_sub_bias; - if (sub_num >= _cairo_array_num_elements(&font->global_sub_index)) + if (sub_num >= (int)_cairo_array_num_elements(&font->global_sub_index)) return CAIRO_INT_STATUS_UNSUPPORTED; element = _cairo_array_index (&font->global_sub_index, sub_num); if (! font->global_subs_used[sub_num] || diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index fb6081c48..80f3a0eb0 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -1680,8 +1680,7 @@ _cairo_svg_surface_emit_static_filter (cairo_svg_document_t *document, enum cair { if (!document->filters_emitted[filter]) { document->filters_emitted[filter] = TRUE; - switch (filter) { - case CAIRO_SVG_FILTER_REMOVE_COLOR: + if (filter == CAIRO_SVG_FILTER_REMOVE_COLOR) { // (r, g, b, a) -> (1, 1, 1, a) _cairo_svg_stream_printf (&document->xml_node_filters, "<filter id=\"filter-remove-color\" " @@ -1692,8 +1691,7 @@ _cairo_svg_surface_emit_static_filter (cairo_svg_document_t *document, enum cair /* */ "0 0 0 0 1 " /* */ "0 0 0 1 0\" />\n" "</filter>\n"); - break; - case CAIRO_SVG_FILTER_REMOVE_COLOR_AND_INVERT_ALPHA: + } else if (filter == CAIRO_SVG_FILTER_REMOVE_COLOR_AND_INVERT_ALPHA) { // (r, g, b, a) -> (1, 1, 1, 1 - a) _cairo_svg_stream_printf (&document->xml_node_filters, "<filter id=\"filter-remove-color-and-invert-alpha\" " @@ -1704,8 +1702,7 @@ _cairo_svg_surface_emit_static_filter (cairo_svg_document_t *document, enum cair /* */ "0 0 0 0 1 " /* */ "0 0 0 -1 1\"/>\n" "</filter>\n"); - break; - case CAIRO_SVG_FILTER_COLOR_TO_ALPHA: + } else if (filter == CAIRO_SVG_FILTER_COLOR_TO_ALPHA) { // (r, g, b, a) -> (1, 1, 1, 0.2126 * r + 0.7152 * g + 0.0722 * b) _cairo_svg_stream_printf (&document->xml_node_filters, "<filter id=\"filter-color-to-alpha\" " @@ -1716,23 +1713,19 @@ _cairo_svg_surface_emit_static_filter (cairo_svg_document_t *document, enum cair /* */ "0 0 0 0 1 " /* */ "0.2126 0.7152 0.0722 0 0\"/>\n" "</filter>\n"); - break; - default: - ASSERT_NOT_REACHED; } } - switch (filter) { - case CAIRO_SVG_FILTER_REMOVE_COLOR: + if (filter == CAIRO_SVG_FILTER_REMOVE_COLOR) { return "remove-color"; - case CAIRO_SVG_FILTER_REMOVE_COLOR_AND_INVERT_ALPHA: + } else if (filter == CAIRO_SVG_FILTER_REMOVE_COLOR_AND_INVERT_ALPHA) { return "remove-color-and-invert-alpha"; - case CAIRO_SVG_FILTER_COLOR_TO_ALPHA: + } else if (filter == CAIRO_SVG_FILTER_COLOR_TO_ALPHA) { return "color-to-alpha"; - default: + } else { ASSERT_NOT_REACHED; - return FALSE; /* squelch warning */ } + return FALSE; /* squelch warning */ } #define _CAIRO_SVG_SURFACE_OUTPUT_FE_COMPOSITE_FILTER(operation) \ @@ -1882,6 +1875,10 @@ _cairo_svg_surface_emit_parametric_filter (cairo_svg_surface_t *surface, case CAIRO_SVG_FILTER_LUMINOSITY: _CAIRO_SVG_SURFACE_OUTPUT_FE_BLEND_FILTER ("luminosity") break; + case CAIRO_SVG_FILTER_REMOVE_COLOR: + case CAIRO_SVG_FILTER_REMOVE_COLOR_AND_INVERT_ALPHA: + case CAIRO_SVG_FILTER_COLOR_TO_ALPHA: + case CAIRO_SVG_FILTER_LAST_STATIC_FILTER: default: ASSERT_NOT_REACHED; } diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index 9565aa625..73f414dc4 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -630,7 +630,7 @@ cairo_type1_font_subset_decrypt_eexec_segment (cairo_type1_font_subset_t *font) unsigned char *in, *end; char *out; int c, p; - int i; + unsigned int i; in = (unsigned char *) font->eexec_segment; end = (unsigned char *) in + font->eexec_segment_size; diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c index 089b64ad2..04c9ee699 100644 --- a/src/cairo-user-font.c +++ b/src/cairo-user-font.c @@ -176,13 +176,13 @@ _cairo_user_scaled_glyph_init (void *abstract_font, status = face->scaled_font_methods.render_color_glyph ((cairo_scaled_font_t *)scaled_font, _cairo_scaled_glyph_index(scaled_glyph), cr, &extents); - if (status == CAIRO_STATUS_SUCCESS) { + if (status == CAIRO_INT_STATUS_SUCCESS) { status = cairo_status (cr); scaled_glyph->has_color = TRUE; } } - if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED && + if (status == (cairo_int_status_t)CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED && face->scaled_font_methods.render_glyph) { recording_surface = _cairo_user_scaled_font_create_recording_surface (scaled_font, FALSE); @@ -196,7 +196,7 @@ _cairo_user_scaled_glyph_init (void *abstract_font, cairo_destroy (cr); } - if (status != CAIRO_STATUS_SUCCESS) { + if (status != CAIRO_INT_STATUS_SUCCESS) { if (recording_surface) cairo_surface_destroy (recording_surface); return status; diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c index 35db4c033..3ca82c4b7 100644 --- a/test/cairo-test-trace.c +++ b/test/cairo-test-trace.c @@ -791,7 +791,8 @@ matches_reference (struct slave *slave) int channel; for (channel = 0; channel < 4; channel++) { - unsigned va, vb, diff; + int va, vb; + unsigned diff; va = (ua[x] >> (channel*8)) & 0xff; vb = (ub[x] >> (channel*8)) & 0xff; @@ -815,7 +816,8 @@ matches_reference (struct slave *slave) int channel; for (channel = 0; channel < 3; channel++) { - unsigned va, vb, diff; + int va, vb; + unsigned diff; va = (ua[x] >> (channel*8)) & 0xff; vb = (ub[x] >> (channel*8)) & 0xff; diff --git a/test/operator-www.c b/test/operator-www.c index 8657980ff..4d804fced 100644 --- a/test/operator-www.c +++ b/test/operator-www.c @@ -28,8 +28,8 @@ #define WIDTH 160 #define HEIGHT 120 -void -example (cairo_t *cr, char *name) +static void +example (cairo_t *cr, const char *name) { cairo_save (cr); cairo_push_group_with_content (cr, cairo_surface_get_content (cairo_get_target (cr))); |