From 1724a8ccd667c6ec468e2e8a01161c32bf59d706 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 24 Apr 2017 11:39:47 +0200 Subject: Rename FMT_zu to FZ_FMT_zu. Don't use FMT_zu macro for fz_throw/fz_warn, since we can portably handle '%zu' in our own printf formatting. --- source/fitz/bidi-std.c | 2 +- source/fitz/draw-glyph.c | 4 ++-- source/fitz/memory.c | 20 ++++++++++---------- source/fitz/store.c | 8 ++++---- source/tools/mudraw.c | 6 +++--- source/tools/muraster.c | 6 +++--- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'source') diff --git a/source/fitz/bidi-std.c b/source/fitz/bidi-std.c index 051b07e8..b56c0a8e 100644 --- a/source/fitz/bidi-std.c +++ b/source/fitz/bidi-std.c @@ -720,7 +720,7 @@ void fz_bidi_resolve_weak(fz_context *ctx, fz_bidi_level baselevel, fz_bidi_char for (ich = 0; ich < cch; ich++) { if (pcls[ich] > BDI_BN) { - fz_warn(ctx, "error: pcls[" FMT_zu "] > BN (%d)\n", ich, pcls[ich]); + fz_warn(ctx, "error: pcls[%zu] > BN (%d)\n", ich, pcls[ich]); } // ignore boundary neutrals diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c index bfd0af40..ffe0d44b 100644 --- a/source/fitz/draw-glyph.c +++ b/source/fitz/draw-glyph.c @@ -455,8 +455,8 @@ fz_dump_glyph_cache_stats(fz_context *ctx) { fz_glyph_cache *cache = ctx->glyph_cache; - fprintf(stderr, "Glyph Cache Size: " FMT_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 (" FMT_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/memory.c b/source/fitz/memory.c index 870ec973..10e6f318 100644 --- a/source/fitz/memory.c +++ b/source/fitz/memory.c @@ -56,7 +56,7 @@ fz_malloc(fz_context *ctx, size_t size) p = do_scavenging_malloc(ctx, size); if (!p) - fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of " FMT_zu " bytes failed", size); + fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of %zu bytes failed", size); return p; } @@ -75,11 +75,11 @@ fz_malloc_array(fz_context *ctx, size_t count, size_t size) return 0; if (count > SIZE_MAX / size) - fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of array (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of array (%zu x %zu bytes) failed (size_t overflow)", count, size); p = do_scavenging_malloc(ctx, count * size); if (!p) - fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of array (" FMT_zu " x " FMT_zu " bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "malloc of array (%zu x %zu bytes) failed", count, size); return p; } @@ -91,7 +91,7 @@ fz_malloc_array_no_throw(fz_context *ctx, size_t count, size_t size) if (count > SIZE_MAX / size) { - fprintf(stderr, "error: malloc of array (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)", count, size); + fprintf(stderr, "error: malloc of array (" FZ_FMT_zu " x " FZ_FMT_zu " bytes) failed (size_t overflow)", count, size); return NULL; } @@ -108,13 +108,13 @@ fz_calloc(fz_context *ctx, size_t count, size_t size) if (count > SIZE_MAX / size) { - fz_throw(ctx, FZ_ERROR_MEMORY, "calloc (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "calloc (%zu x %zu bytes) failed (size_t overflow)", count, size); } p = do_scavenging_malloc(ctx, count * size); if (!p) { - fz_throw(ctx, FZ_ERROR_MEMORY, "calloc (" FMT_zu " x " FMT_zu " bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "calloc (%zu x %zu bytes) failed", count, size); } memset(p, 0, count*size); return p; @@ -130,7 +130,7 @@ fz_calloc_no_throw(fz_context *ctx, size_t count, size_t size) if (count > SIZE_MAX / size) { - fprintf(stderr, "error: calloc (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)\n", count, size); + fprintf(stderr, "error: calloc (" FZ_FMT_zu " x " FZ_FMT_zu " bytes) failed (size_t overflow)\n", count, size); return NULL; } @@ -154,11 +154,11 @@ fz_resize_array(fz_context *ctx, void *p, size_t count, size_t size) } if (count > SIZE_MAX / size) - fz_throw(ctx, FZ_ERROR_MEMORY, "resize array (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "resize array (%zu x %zu bytes) failed (size_t overflow)", count, size); np = do_scavenging_realloc(ctx, p, count * size); if (!np) - fz_throw(ctx, FZ_ERROR_MEMORY, "resize array (" FMT_zu " x " FMT_zu " bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_MEMORY, "resize array (%zu x %zu bytes) failed", count, size); return np; } @@ -173,7 +173,7 @@ fz_resize_array_no_throw(fz_context *ctx, void *p, size_t count, size_t size) if (count > SIZE_MAX / size) { - fprintf(stderr, "error: resize array (" FMT_zu " x " FMT_zu " bytes) failed (size_t overflow)\n", count, size); + fprintf(stderr, "error: resize array (" FZ_FMT_zu " x " FZ_FMT_zu " bytes) failed (size_t overflow)\n", count, size); return NULL; } diff --git a/source/fitz/store.c b/source/fitz/store.c index d7c04241..dbff08fc 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -750,7 +750,7 @@ int fz_store_scavenge(fz_context *ctx, size_t size, int *phase) return 0; #ifdef DEBUG_SCAVENGING - printf("Scavenging: store=" FMT_zu " size=" FMT_zu " phase=%d\n", store->size, size, *phase); + printf("Scavenging: store=" FZ_FMT_zu " size=" FZ_FMT_zu " phase=%d\n", store->size, size, *phase); fz_print_store_locked(ctx, stderr); Memento_stats(); #endif @@ -778,7 +778,7 @@ int fz_store_scavenge(fz_context *ctx, size_t size, int *phase) if (scavenge(ctx, tofree)) { #ifdef DEBUG_SCAVENGING - printf("scavenged: store=" FMT_zu "\n", store->size); + printf("scavenged: store=" FZ_FMT_zu "\n", store->size); fz_print_store(ctx, stderr); Memento_stats(); #endif @@ -810,7 +810,7 @@ fz_shrink_store(fz_context *ctx, unsigned int percent) return 0; #ifdef DEBUG_SCAVENGING - fprintf(stderr, "fz_shrink_store: " FMT_zu "\n", store->size/(1024*1024)); + fprintf(stderr, "fz_shrink_store: " FZ_FMT_zu "\n", store->size/(1024*1024)); #endif fz_lock(ctx, FZ_LOCK_ALLOC); @@ -821,7 +821,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 - fprintf(stderr, "fz_shrink_store after: " FMT_zu "\n", store->size/(1024*1024)); + fprintf(stderr, "fz_shrink_store after: " FZ_FMT_zu "\n", store->size/(1024*1024)); #endif return success; diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index 63f953c4..0e9ec27d 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -1765,9 +1765,9 @@ int mudraw_main(int argc, char **argv) if (showmemory) { - fprintf(stderr, "Total memory use = " FMT_zu " bytes\n", memtrace_total); - fprintf(stderr, "Peak memory use = " FMT_zu " bytes\n", memtrace_peak); - fprintf(stderr, "Current memory use = " FMT_zu " bytes\n", memtrace_current); + fprintf(stderr, "Total memory use = " FZ_FMT_zu " bytes\n", memtrace_total); + fprintf(stderr, "Peak memory use = " FZ_FMT_zu " bytes\n", memtrace_peak); + fprintf(stderr, "Current memory use = " FZ_FMT_zu " bytes\n", memtrace_current); } return (errored != 0); diff --git a/source/tools/muraster.c b/source/tools/muraster.c index c8b97a54..b8d9a4d9 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -1709,9 +1709,9 @@ int main(int argc, char **argv) if (showmemory) { - fprintf(stderr, "Total memory use = " FMT_zu " bytes\n", memtrace_total); - fprintf(stderr, "Peak memory use = " FMT_zu " bytes\n", memtrace_peak); - fprintf(stderr, "Current memory use = " FMT_zu " bytes\n", memtrace_current); + fprintf(stderr, "Total memory use = " FZ_FMT_zu " bytes\n", memtrace_total); + fprintf(stderr, "Peak memory use = " FZ_FMT_zu " bytes\n", memtrace_peak); + fprintf(stderr, "Current memory use = " FZ_FMT_zu " bytes\n", memtrace_current); } return (errored != 0); -- cgit v1.2.3