diff options
Diffstat (limited to 'scripts/cmapdump.c')
-rw-r--r-- | scripts/cmapdump.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c index 68a5c3cf..be7a456e 100644 --- a/scripts/cmapdump.c +++ b/scripts/cmapdump.c @@ -3,9 +3,13 @@ #include <stdio.h> #include <string.h> +/* We never want to build memento versions of the cmapdump util */ +#undef MEMENTO + #include "fitz.h" #include "mupdf.h" +#include "../fitz/base_context.c" #include "../fitz/base_error.c" #include "../fitz/base_memory.c" #include "../fitz/base_string.c" @@ -38,6 +42,7 @@ main(int argc, char **argv) char name[256]; char *realname; int i, k; + fz_context *ctx; if (argc < 3) { @@ -45,6 +50,13 @@ main(int argc, char **argv) return 1; } + ctx = fz_new_context(&fz_alloc_default); + if (ctx == NULL) + { + fprintf(stderr, "failed to initialise!\n"); + return 1; + } + fo = fopen(argv[1], "wb"); if (!fo) { @@ -73,14 +85,17 @@ main(int argc, char **argv) strcpy(name, realname); clean(name); - fi = fz_open_file(argv[i]); + fi = fz_open_file(ctx, argv[i]); if (!fi) - fz_throw("cmapdump: could not open input file '%s'\n", argv[i]); + fz_error_make("cmapdump: could not open input file '%s'\n", argv[i]); - error = pdf_parse_cmap(&cmap, fi); - if (error) + fz_try(ctx) { - fz_catch(error, "cmapdump: could not parse input cmap '%s'\n", argv[i]); + cmap = pdf_parse_cmap(fi); + } + fz_catch(ctx) + { + fz_error_handle(error, "cmapdump: could not parse input cmap '%s'\n", argv[i]); return 1; } @@ -154,5 +169,22 @@ main(int argc, char **argv) return 1; } + fz_free_context(ctx); return 0; } + +void fz_new_font_context(fz_context *ctx) +{ +} + +void fz_free_font_context(fz_context *ctx) +{ +} + +void fz_new_aa_context(fz_context *ctx) +{ +} + +void fz_free_aa_context(fz_context *ctx) +{ +} |