summaryrefslogtreecommitdiff
path: root/source/fitz/store.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-01-12 17:30:59 +0000
committerRobin Watts <robin.watts@artifex.com>2016-01-13 12:32:58 +0000
commitad8936bf2bcf54c7042bdec20c49c96657649b34 (patch)
tree0d6e309f5747e493632b72b34acef1e53e1ed9d7 /source/fitz/store.c
parent881b7ea89588677e709aaa7d3d0ffe4aed63822a (diff)
downloadmupdf-ad8936bf2bcf54c7042bdec20c49c96657649b34.tar.xz
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.
Diffstat (limited to 'source/fitz/store.c')
-rw-r--r--source/fitz/store.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/fitz/store.c b/source/fitz/store.c
index 4bb54c19..c2c86b00 100644
--- a/source/fitz/store.c
+++ b/source/fitz/store.c
@@ -54,14 +54,22 @@ fz_new_store_context(fz_context *ctx, unsigned int max)
}
void *
-fz_keep_storable(fz_context *ctx, fz_storable *s)
+fz_keep_storable(fz_context *ctx, const fz_storable *sc)
{
+ /* Explicitly drop const to allow us to use const
+ * sanely throughout the code. */
+ fz_storable *s = (fz_storable *)sc;
+
return fz_keep_imp(ctx, s, &s->refs);
}
void
-fz_drop_storable(fz_context *ctx, fz_storable *s)
+fz_drop_storable(fz_context *ctx, const fz_storable *sc)
{
+ /* Explicitly drop const to allow us to use const
+ * sanely throughout the code. */
+ fz_storable *s = (fz_storable *)sc;
+
/*
If we are dropping the last reference to an object, then
it cannot possibly be in the store (as the store always