[gs-commits] mupdf 1.16.1.46 Fix glyph size printfs.
[email protected] (Robin Watts) Mon, 30 Sep 2019 15:22:27 +0000 (UTC)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit fa702acdf58a36204427aab55ed39c07c25dc984 Author: Robin Watts <[email protected]> Date: Fri Sep 27 10:18:08 2019 +0100 Fix glyph size printfs. %zu is not recognised by MSVC runtimes < 2015 (or thereabouts). Move to calling fz_write_printf instead of fprintf. We removed fz_stderr a while ago (for a good reason, as it could cause problems). Put a simpler, safe version back. Also, we removed FZ_FMT_zu a while ago and didn't remove it from some debug outputs. Fix that too. diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c index b4c1a69..92dde30 100644 --- a/source/fitz/draw-glyph.c +++ b/source/fitz/draw-glyph.c @@ -450,8 +450,8 @@ void fz_dump_glyph_cache_stats(fz_context *ctx) { fz_glyph_cache *cache = ctx->glyph_cache; - fprintf(stderr, "Glyph Cache Size: %zu\n", cache->total); + fz_write_printf(ctx, fz_stderr(ctx), "Glyph Cache Size: %zu\n", cache->total); #ifndef NDEBUG - fprintf(stderr, "Glyph Cache Evictions: %d (%zu bytes)\n", cache->num_evictions, cache->evicted); + fz_write_printf(ctx, fz_stderr(ctx), "Glyph Cache Evictions: %d (%zu bytes)\n", cache->num_evictions, cache->evicted); #endif } diff --git a/source/fitz/output.c b/source/fitz/output.c index c39ab14..acfc0e4 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -53,6 +53,25 @@ fz_output *fz_stdout(fz_context *ctx) } static void +stderr_write(fz_context *ctx, void *opaque, const void *buffer, size_t count) +{ + file_write(ctx, stderr, buffer, count); +} + +static fz_output fz_stderr_global = { + NULL, + stderr_write, + NULL, + NULL, + NULL, +}; + +fz_output *fz_stderr(fz_context *ctx) +{ + return &fz_stderr_global; +} + +static void file_seek(fz_context *ctx, void *opaque, int64_t off, int whence) { FILE *file = opaque; diff --git a/source/fitz/store.c b/source/fitz/store.c index b296afc..f652b96 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -892,7 +892,7 @@ int fz_store_scavenge(fz_context *ctx, size_t size, int *phase) return 0; #ifdef DEBUG_SCAVENGING - printf("Scavenging: store=" FZ_FMT_zu " size=" FZ_FMT_zu " phase=%d\n", store->size, size, *phase); + fz_write_printf(ctx, fz_stdout(ctx), "Scavenging: store=%zu size=%zu phase=%d\n", store->size, size, *phase); fz_debug_store_locked(ctx); Memento_stats(); #endif @@ -920,7 +920,7 @@ int fz_store_scavenge(fz_context *ctx, size_t size, int *phase) if (scavenge(ctx, tofree)) { #ifdef DEBUG_SCAVENGING - printf("scavenged: store=" FZ_FMT_zu "\n", store->size); + fz_write_printf(ctx, fz_stdout(ctx), "scavenged: store=%zu\n", store->size); fz_debug_store(ctx); Memento_stats(); #endif @@ -961,7 +961,7 @@ fz_shrink_store(fz_context *ctx, unsigned int percent) return 0; #ifdef DEBUG_SCAVENGING - printf("fz_shrink_store: " FZ_FMT_zu "\n", store->size/(1024*1024)); + fz_write_printf(ctx, fz_stdout(ctx), "fz_shrink_store: %zu\n", store->size/(1024*1024)); #endif fz_lock(ctx, FZ_LOCK_ALLOC); @@ -972,7 +972,7 @@ fz_shrink_store(fz_context *ctx, unsigned int percent) success = (store->size <= new_size) ? 1 : 0; fz_unlock(ctx, FZ_LOCK_ALLOC); #ifdef DEBUG_SCAVENGING - printf("fz_shrink_store after: " FZ_FMT_zu "\n", store->size/(1024*1024)); + fz_write_printf(ctx, fz_stdout(ctx), "fz_shrink_store after: %zu\n", store->size/(1024*1024)); #endif return success; http://git.ghostscript.com/?p=mupdf.git;a=commit;h=fa702acdf58a36204427aab55ed39c07c25dc984 -- MuPDF library Artifex Software, Inc.