[cairo] [PATCH 3/4] script surface: Avoid compiler warnings
Simon Richter
Simon.Richter at hogyros.de
Wed Feb 10 21:49:07 CET 2016
This is not strictly necessary, as the pointer <-> integer casts here are
never performed on actual valid pointers, but this change avoids a bunch of
warnings that look dangerous.
---
src/cairo-script-surface.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index ea0117d..d5f890e 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -3021,7 +3021,7 @@ _emit_scaled_glyph_vector (cairo_script_surface_t *surface,
cairo_script_context_t *ctx = to_context (surface);
cairo_script_implicit_context_t old_cr;
cairo_status_t status;
- unsigned long index;
+ intptr_t index;
index = ++font_private->subset_glyph_index;
scaled_glyph->dev_private_key = ctx;
@@ -3069,7 +3069,7 @@ _emit_scaled_glyph_bitmap (cairo_script_surface_t *surface,
{
cairo_script_context_t *ctx = to_context (surface);
cairo_status_t status;
- unsigned long index;
+ intptr_t index;
index = ++font_private->subset_glyph_index;
scaled_glyph->dev_private_key = ctx;
@@ -3373,7 +3373,7 @@ _cairo_script_surface_show_text_glyphs (void *abstract_surface,
goto BAIL;
}
- if ((long unsigned) scaled_glyph->dev_private > 256)
+ if ((intptr_t) scaled_glyph->dev_private > 256)
break;
}
}
@@ -3438,23 +3438,17 @@ _cairo_script_surface_show_text_glyphs (void *abstract_surface,
}
}
}
- if (base85_stream != NULL) {
- uint8_t c;
+ uint8_t c;
- if (font_private->has_sfnt)
- c = glyphs[n].index;
- else
- c = (uint8_t) (long unsigned) scaled_glyph->dev_private;
+ if (font_private->has_sfnt)
+ c = glyphs[n].index;
+ else
+ c = (uint8_t) (((intptr_t) scaled_glyph->dev_private) & 0xff);
+ if (base85_stream != NULL)
_cairo_output_stream_write (base85_stream, &c, 1);
- } else {
- if (font_private->has_sfnt)
- _cairo_output_stream_printf (ctx->stream, " %lu",
- glyphs[n].index);
- else
- _cairo_output_stream_printf (ctx->stream, " %lu",
- (long unsigned) scaled_glyph->dev_private);
- }
+ else
+ _cairo_output_stream_printf (ctx->stream, " %u", c);
dx = scaled_glyph->metrics.x_advance;
dy = scaled_glyph->metrics.y_advance;
--
2.1.4
More information about the cairo
mailing list