summaryrefslogtreecommitdiff
path: root/scripts/cmapcleanx.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmapcleanx.c')
-rw-r--r--scripts/cmapcleanx.c138
1 files changed, 5 insertions, 133 deletions
diff --git a/scripts/cmapcleanx.c b/scripts/cmapcleanx.c
index a433c8a4..6900d7b1 100644
--- a/scripts/cmapcleanx.c
+++ b/scripts/cmapcleanx.c
@@ -1,36 +1,10 @@
/* cmapclean.c -- parse a CMap file and write it back out */
-/* We never want to build memento versions of the cmapdump util */
-#undef MEMENTO
-
-/* We never want large file access here */
-#undef FZ_LARGEFILE
-
#include <stdio.h>
#include <string.h>
#include "mupdf/pdf.h"
-#include "../source/fitz/context.c"
-#include "../source/fitz/error.c"
-#include "../source/fitz/memory.c"
-#include "../source/fitz/output.c"
-#include "../source/fitz/string.c"
-#include "../source/fitz/buffer.c"
-#include "../source/fitz/stream-open.c"
-#include "../source/fitz/stream-read.c"
-#include "../source/fitz/strtod.c"
-#include "../source/fitz/strtof.c"
-#include "../source/fitz/ftoa.c"
-#include "../source/fitz/printf.c"
-#ifdef _WIN32
-#include "../source/fitz/time.c"
-#endif
-
-#include "../source/pdf/pdf-lex.c"
-#include "../source/pdf/pdf-cmap.c"
-#include "../source/pdf/pdf-cmap-parse.c"
-
struct cidrange {
unsigned int lo, hi, v;
};
@@ -74,7 +48,7 @@ main(int argc, char **argv)
fi = fz_open_file(ctx, argv[1]);
cmap = pdf_load_cmap(ctx, fi);
- fz_close(fi);
+ fz_drop_stream(ctx, fi);
printf("begincmap\n");
printf("/CMapName /%s def\n", cmap->cmap_name);
@@ -102,7 +76,7 @@ main(int argc, char **argv)
}
n = cmap->rlen + cmap->xlen;
- r = malloc(n * sizeof *r);
+ r = fz_malloc(ctx, n * sizeof *r);
i = 0;
for (k = 0; k < cmap->rlen; k++) {
@@ -135,6 +109,7 @@ main(int argc, char **argv)
printf("endcidchar\n");
}
+#if 0
if (cmap->mlen > 0)
{
printf("beginbfchar\n");
@@ -149,113 +124,10 @@ main(int argc, char **argv)
}
printf("endbfchar\n");
}
+#endif
printf("endcmap\n");
- fz_free_context(ctx);
- return 0;
-}
-
-void fz_new_font_context(fz_context *ctx)
-{
-}
-
-void fz_drop_font_context(fz_context *ctx)
-{
-}
-
-fz_font_context *fz_keep_font_context(fz_context *ctx)
-{
- return NULL;
-}
-
-void fz_new_colorspace_context(fz_context *ctx)
-{
-}
-
-void fz_drop_colorspace_context(fz_context *ctx)
-{
-}
-
-fz_colorspace_context *fz_keep_colorspace_context(fz_context *ctx)
-{
- return NULL;
-}
-
-void fz_new_aa_context(fz_context *ctx)
-{
-}
-
-void fz_drop_aa_context(fz_context *ctx)
-{
-}
-
-void fz_copy_aa_context(fz_context *dst, fz_context *src)
-{
-}
-
-void *fz_keep_storable(fz_context *ctx, const fz_storable *sc)
-{
- fz_storable *s = (fz_storable *)sc;
- return fz_keep_imp(ctx, s, &s->refs);
-}
-
-void fz_drop_storable(fz_context *ctx, const fz_storable *sc)
-{
- fz_storable *s = (fz_storable *)sc;
- if (fz_drop_imp(ctx, s, &s->refs))
- s->drop(ctx, s);
-}
-
-void fz_new_store_context(fz_context *ctx, size_t max)
-{
-}
-
-void fz_drop_store_context(fz_context *ctx)
-{
-}
-
-fz_store *fz_keep_store_context(fz_context *ctx)
-{
- return NULL;
-}
-
-int fz_store_scavenge(fz_context *ctx, size_t size, int *phase)
-{
- return 0;
-}
-
-void fz_new_glyph_cache_context(fz_context *ctx)
-{
-}
-
-void fz_drop_glyph_cache_context(fz_context *ctx)
-{
-}
-
-fz_glyph_cache *fz_keep_glyph_cache(fz_context *ctx)
-{
- return NULL;
-}
-
-void fz_new_document_handler_context(fz_context *ctx)
-{
-}
-
-void fz_drop_document_handler_context(fz_context *ctx)
-{
-}
-
-fz_document_handler_context *fz_keep_document_handler_context(fz_context *ctx)
-{
- return NULL;
-}
-
-void fz_default_image_decode(void *arg, int w, int h, int l2factor, fz_irect *irect)
-{
-}
-
-int fz_default_image_scale(void *arg, int w, int h, int src_w, int src_h)
-{
+ fz_drop_context(ctx);
return 0;
}