From ad8936bf2bcf54c7042bdec20c49c96657649b34 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 12 Jan 2016 17:30:59 +0000 Subject: Add lots of consts. In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems. --- source/fitz/path.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/fitz/path.c') diff --git a/source/fitz/path.c b/source/fitz/path.c index fbc5ef47..d5b662d2 100644 --- a/source/fitz/path.c +++ b/source/fitz/path.c @@ -907,7 +907,7 @@ static const fz_path_processor bound_path_proc = }; fz_rect * -fz_bound_path(fz_context *ctx, fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r) +fz_bound_path(fz_context *ctx, const fz_path *path, const fz_stroke_state *stroke, const fz_matrix *ctm, fz_rect *r) { bound_path_arg arg; @@ -1422,8 +1422,10 @@ const fz_stroke_state fz_default_stroke_state = { }; fz_stroke_state * -fz_keep_stroke_state(fz_context *ctx, fz_stroke_state *stroke) +fz_keep_stroke_state(fz_context *ctx, const fz_stroke_state *strokec) { + fz_stroke_state *stroke = (fz_stroke_state *)strokec; /* Explicit cast away of const */ + if (!stroke) return NULL; @@ -1435,8 +1437,10 @@ fz_keep_stroke_state(fz_context *ctx, fz_stroke_state *stroke) } void -fz_drop_stroke_state(fz_context *ctx, fz_stroke_state *stroke) +fz_drop_stroke_state(fz_context *ctx, const fz_stroke_state *strokec) { + fz_stroke_state *stroke = (fz_stroke_state *)strokec; /* Explicit cast away of const */ + if (fz_drop_imp(ctx, stroke, &stroke->refs)) fz_free(ctx, stroke); } -- cgit v1.2.3