summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-06-08 12:42:57 +0100
committerRobin Watts <robin.watts@artifex.com>2016-06-08 13:53:56 +0100
commit2fd7f11cfe4ebdc6d1035db521e61d15101ab36e (patch)
treecf18d3cc3ab606b4f22684ef4ea2ea3f06d41602 /source/tools
parentfea0f8467f983cc5c1075d19787a4b398d0d5e22 (diff)
downloadmupdf-2fd7f11cfe4ebdc6d1035db521e61d15101ab36e.tar.xz
Move to using size_t for all mallocs.
This has knock on effects in the store. fix
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c17
-rw-r--r--source/tools/pdfinfo.c18
2 files changed, 14 insertions, 21 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 12d5247a..2773d357 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -1242,7 +1242,7 @@ typedef struct
} trace_header;
static void *
-trace_malloc(void *arg, unsigned int size)
+trace_malloc(void *arg, size_t size)
{
trace_header *p;
if (size == 0)
@@ -1270,7 +1270,7 @@ trace_free(void *arg, void *p_)
}
static void *
-trace_realloc(void *arg, void *p_, unsigned int size)
+trace_realloc(void *arg, void *p_, size_t size)
{
trace_header *p = (trace_header *)p_;
size_t oldsize;
@@ -1764,16 +1764,9 @@ int mudraw_main(int argc, char **argv)
if (showmemory)
{
-#if defined(_WIN64)
-#define FMT "%Iu"
-#elif defined(_WIN32)
-#define FMT "%u"
-#else
-#define FMT "%zu"
-#endif
- fprintf(stderr, "Total memory use = " FMT " bytes\n", memtrace_total);
- fprintf(stderr, "Peak memory use = " FMT " bytes\n", memtrace_peak);
- fprintf(stderr, "Current memory use = " FMT " bytes\n", memtrace_current);
+ 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);
}
return (errored != 0);
diff --git a/source/tools/pdfinfo.c b/source/tools/pdfinfo.c
index fd52d12f..9df8e182 100644
--- a/source/tools/pdfinfo.c
+++ b/source/tools/pdfinfo.c
@@ -668,14 +668,14 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
int j;
fz_output *out = glo->out;
-#define PAGE_FMT "\t%d\t(%d %d R):\t"
+#define PAGE_FMT_zu "\t%d\t(%d %d R):\t"
if (show & DIMENSIONS && glo->dims > 0)
{
fz_printf(ctx, out, "Mediaboxes (%d):\n", glo->dims);
for (i = 0; i < glo->dims; i++)
{
- fz_printf(ctx, out, PAGE_FMT "[ %g %g %g %g ]\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "[ %g %g %g %g ]\n",
glo->dim[i].page,
pdf_to_num(ctx, glo->dim[i].pageref),
pdf_to_gen(ctx, glo->dim[i].pageref),
@@ -692,7 +692,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
fz_printf(ctx, out, "Fonts (%d):\n", glo->fonts);
for (i = 0; i < glo->fonts; i++)
{
- fz_printf(ctx, out, PAGE_FMT "%s '%s' (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "%s '%s' (%d %d R)\n",
glo->font[i].page,
pdf_to_num(ctx, glo->font[i].pageref),
pdf_to_gen(ctx, glo->font[i].pageref),
@@ -712,7 +712,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
char *cs = NULL;
char *altcs = NULL;
- fz_printf(ctx, out, PAGE_FMT "[ ",
+ fz_printf(ctx, out, PAGE_FMT_zu "[ ",
glo->image[i].page,
pdf_to_num(ctx, glo->image[i].pageref),
pdf_to_gen(ctx, glo->image[i].pageref));
@@ -820,7 +820,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
"Tensor patch",
};
- fz_printf(ctx, out, PAGE_FMT "%s (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "%s (%d %d R)\n",
glo->shading[i].page,
pdf_to_num(ctx, glo->shading[i].pageref),
pdf_to_gen(ctx, glo->shading[i].pageref),
@@ -852,7 +852,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
"Constant/fast tiling",
};
- fz_printf(ctx, out, PAGE_FMT "Tiling %s %s (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "Tiling %s %s (%d %d R)\n",
glo->pattern[i].page,
pdf_to_num(ctx, glo->pattern[i].pageref),
pdf_to_gen(ctx, glo->pattern[i].pageref),
@@ -863,7 +863,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
}
else
{
- fz_printf(ctx, out, PAGE_FMT "Shading %d %d R (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "Shading %d %d R (%d %d R)\n",
glo->pattern[i].page,
pdf_to_num(ctx, glo->pattern[i].pageref),
pdf_to_gen(ctx, glo->pattern[i].pageref),
@@ -881,7 +881,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
fz_printf(ctx, out, "Form xobjects (%d):\n", glo->forms);
for (i = 0; i < glo->forms; i++)
{
- fz_printf(ctx, out, PAGE_FMT "Form%s%s%s%s (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "Form%s%s%s%s (%d %d R)\n",
glo->form[i].page,
pdf_to_num(ctx, glo->form[i].pageref),
pdf_to_gen(ctx, glo->form[i].pageref),
@@ -900,7 +900,7 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
fz_printf(ctx, out, "Postscript xobjects (%d):\n", glo->psobjs);
for (i = 0; i < glo->psobjs; i++)
{
- fz_printf(ctx, out, PAGE_FMT "(%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "(%d %d R)\n",
glo->psobj[i].page,
pdf_to_num(ctx, glo->psobj[i].pageref),
pdf_to_gen(ctx, glo->psobj[i].pageref),