diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-26 14:34:31 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-27 15:12:03 +0200 |
commit | 2ccb4fe72b9af0241d16a0d206fc8dcf3c2497df (patch) | |
tree | a983427b532e9f082bc58ce26b91ff782f858f55 /source/fitz/draw-device.c | |
parent | cabf4489896a2a978361eb6e1df4b4aef81193f4 (diff) | |
download | mupdf-2ccb4fe72b9af0241d16a0d206fc8dcf3c2497df.tar.xz |
Clean up store debug printing.
Replace fz_print_hash with fz_hash_for_each iterator.
Use string formatting callback.
Diffstat (limited to 'source/fitz/draw-device.c')
-rw-r--r-- | source/fitz/draw-device.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c index f4425558..4e10829f 100644 --- a/source/fitz/draw-device.c +++ b/source/fitz/draw-device.c @@ -1899,7 +1899,7 @@ typedef struct static int fz_make_hash_tile_key(fz_context *ctx, fz_store_hash *hash, void *key_) { - tile_key *key = (tile_key *)key_; + tile_key *key = key_; hash->u.im.id = key->id; hash->u.im.m[0] = key->ctm[0]; @@ -1912,14 +1912,14 @@ fz_make_hash_tile_key(fz_context *ctx, fz_store_hash *hash, void *key_) static void * fz_keep_tile_key(fz_context *ctx, void *key_) { - tile_key *key = (tile_key *)key_; + tile_key *key = key_; return fz_keep_imp(ctx, key, &key->refs); } static void fz_drop_tile_key(fz_context *ctx, void *key_) { - tile_key *key = (tile_key *)key_; + tile_key *key = key_; if (fz_drop_imp(ctx, key, &key->refs)) fz_free(ctx, key); } @@ -1927,16 +1927,21 @@ fz_drop_tile_key(fz_context *ctx, void *key_) static int fz_cmp_tile_key(fz_context *ctx, void *k0_, void *k1_) { - tile_key *k0 = (tile_key *)k0_; - tile_key *k1 = (tile_key *)k1_; - return k0->id == k1->id && k0->ctm[0] == k1->ctm[0] && k0->ctm[1] == k1->ctm[1] && k0->ctm[2] == k1->ctm[2] && k0->ctm[3] == k1->ctm[3]; + tile_key *k0 = k0_; + tile_key *k1 = k1_; + return k0->id == k1->id && + k0->ctm[0] == k1->ctm[0] && + k0->ctm[1] == k1->ctm[1] && + k0->ctm[2] == k1->ctm[2] && + k0->ctm[3] == k1->ctm[3]; } static void -fz_print_tile(fz_context *ctx, fz_output *out, void *key_) +fz_format_tile_key(fz_context *ctx, char *s, int n, void *key_) { tile_key *key = (tile_key *)key_; - fz_write_printf(ctx, out, "(tile id=%x, ctm=%g %g %g %g) ", key->id, key->ctm[0], key->ctm[1], key->ctm[2], key->ctm[3]); + fz_snprintf(s, n, "(tile id=%x, ctm=%g %g %g %g)", + key->id, key->ctm[0], key->ctm[1], key->ctm[2], key->ctm[3]); } static const fz_store_type fz_tile_store_type = @@ -1945,7 +1950,8 @@ static const fz_store_type fz_tile_store_type = fz_keep_tile_key, fz_drop_tile_key, fz_cmp_tile_key, - fz_print_tile + fz_format_tile_key, + NULL }; static void |