diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-07 03:21:25 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-07 03:21:25 +0200 |
commit | 6294585ac2dfe73654a9ac5965517219e4ea7ede (patch) | |
tree | 82523e3b737cf4303679beb7fba586b7dc9db63b | |
parent | b3c8fbeb0dbb2c4b4ed767b7917ada9fa31b353a (diff) | |
download | mupdf-6294585ac2dfe73654a9ac5965517219e4ea7ede.tar.xz |
pdf: Purge unmaintained debug/log printing messages.
-rw-r--r-- | pdf/mupdf.h | 7 | ||||
-rw-r--r-- | pdf/pdf_annot.c | 24 | ||||
-rw-r--r-- | pdf/pdf_cmap_load.c | 11 | ||||
-rw-r--r-- | pdf/pdf_colorspace.c | 22 | ||||
-rw-r--r-- | pdf/pdf_debug.c | 91 | ||||
-rw-r--r-- | pdf/pdf_font.c | 71 | ||||
-rw-r--r-- | pdf/pdf_function.c | 31 | ||||
-rw-r--r-- | pdf/pdf_image.c | 12 | ||||
-rw-r--r-- | pdf/pdf_outline.c | 33 | ||||
-rw-r--r-- | pdf/pdf_page.c | 10 | ||||
-rw-r--r-- | pdf/pdf_pattern.c | 17 | ||||
-rw-r--r-- | pdf/pdf_repair.c | 7 | ||||
-rw-r--r-- | pdf/pdf_shade.c | 30 | ||||
-rw-r--r-- | pdf/pdf_store.c | 2 | ||||
-rw-r--r-- | pdf/pdf_type3.c | 14 | ||||
-rw-r--r-- | pdf/pdf_unicode.c | 9 | ||||
-rw-r--r-- | pdf/pdf_xobject.c | 19 | ||||
-rw-r--r-- | pdf/pdf_xref.c | 28 | ||||
-rw-r--r-- | win32/libmupdf.vcproj | 4 |
19 files changed, 16 insertions, 426 deletions
diff --git a/pdf/mupdf.h b/pdf/mupdf.h index a85d23a7..1c08345a 100644 --- a/pdf/mupdf.h +++ b/pdf/mupdf.h @@ -7,13 +7,6 @@ typedef struct pdf_xref_s pdf_xref; -void pdf_log_xref(char *fmt, ...); -void pdf_log_rsrc(char *fmt, ...); -void pdf_log_font(char *fmt, ...); -void pdf_log_image(char *fmt, ...); -void pdf_log_shade(char *fmt, ...); -void pdf_log_page(char *fmt, ...); - /* * tokenizer and low-level object parser */ diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index 39ac9d2a..2436b0c0 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -46,18 +46,11 @@ pdf_load_link(pdf_xref *xref, fz_obj *dict) fz_rect bbox; pdf_link_kind kind; - pdf_log_page("load link {\n"); - dest = NULL; obj = fz_dict_gets(dict, "Rect"); if (obj) - { bbox = pdf_to_rect(obj); - pdf_log_page("rect [%g %g %g %g]\n", - bbox.x0, bbox.y0, - bbox.x1, bbox.y1); - } else bbox = fz_empty_rect; @@ -66,7 +59,6 @@ pdf_load_link(pdf_xref *xref, fz_obj *dict) { kind = PDF_LINK_GOTO; dest = resolve_dest(xref, obj); - pdf_log_page("dest (%d %d R)\n", fz_to_num(dest), fz_to_gen(dest)); } action = fz_dict_gets(dict, "A"); @@ -77,41 +69,33 @@ pdf_load_link(pdf_xref *xref, fz_obj *dict) { kind = PDF_LINK_GOTO; dest = resolve_dest(xref, fz_dict_gets(action, "D")); - pdf_log_page("action goto (%d %d R)\n", fz_to_num(dest), fz_to_gen(dest)); } else if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "URI")) { kind = PDF_LINK_URI; dest = fz_dict_gets(action, "URI"); - pdf_log_page("action uri %s\n", fz_to_str_buf(dest)); } else if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Launch")) { kind = PDF_LINK_LAUNCH; dest = fz_dict_gets(action, "F"); - pdf_log_page("action %s (%d %d R)\n", fz_to_name(obj), fz_to_num(dest), fz_to_gen(dest)); } else if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Named")) { kind = PDF_LINK_NAMED; dest = fz_dict_gets(action, "N"); - pdf_log_page("action %s (%d %d R)\n", fz_to_name(obj), fz_to_num(dest), fz_to_gen(dest)); } else if (fz_is_name(obj) && (!strcmp(fz_to_name(obj), "GoToR"))) { kind = PDF_LINK_ACTION; dest = action; - pdf_log_page("action %s (%d %d R)\n", fz_to_name(obj), fz_to_num(dest), fz_to_gen(dest)); } else { - pdf_log_page("unhandled link action, ignoring link\n"); dest = NULL; } } - pdf_log_page("}\n"); - if (dest) { pdf_link *link = fz_malloc(sizeof(pdf_link)); @@ -135,8 +119,6 @@ pdf_load_links(pdf_link **linkp, pdf_xref *xref, fz_obj *annots) head = tail = NULL; link = NULL; - pdf_log_page("load link annotations {\n"); - for (i = 0; i < fz_array_len(annots); i++) { obj = fz_array_get(annots, i); @@ -153,8 +135,6 @@ pdf_load_links(pdf_link **linkp, pdf_xref *xref, fz_obj *annots) } } - pdf_log_page("}\n"); - *linkp = head; } @@ -198,8 +178,6 @@ pdf_load_annots(pdf_annot **annotp, pdf_xref *xref, fz_obj *annots) head = tail = NULL; annot = NULL; - pdf_log_page("load appearance annotations {\n"); - for (i = 0; i < fz_array_len(annots); i++) { obj = fz_array_get(annots, i); @@ -246,7 +224,5 @@ pdf_load_annots(pdf_annot **annotp, pdf_xref *xref, fz_obj *annots) } } - pdf_log_page("}\n"); - *annotp = head; } diff --git a/pdf/pdf_cmap_load.c b/pdf/pdf_cmap_load.c index d671b234..12adeb40 100644 --- a/pdf/pdf_cmap_load.c +++ b/pdf/pdf_cmap_load.c @@ -20,8 +20,6 @@ pdf_load_embedded_cmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmobj) return fz_okay; } - pdf_log_font("load embedded cmap (%d %d R) {\n", fz_to_num(stmobj), fz_to_gen(stmobj)); - error = pdf_open_stream(&file, xref, fz_to_num(stmobj), fz_to_gen(stmobj)); if (error) { @@ -40,15 +38,11 @@ pdf_load_embedded_cmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmobj) wmode = fz_dict_gets(stmobj, "WMode"); if (fz_is_int(wmode)) - { - pdf_log_font("wmode %d\n", wmode); pdf_set_wmode(cmap, fz_to_int(wmode)); - } obj = fz_dict_gets(stmobj, "UseCMap"); if (fz_is_name(obj)) { - pdf_log_font("usecmap /%s\n", fz_to_name(obj)); error = pdf_load_system_cmap(&usecmap, fz_to_name(obj)); if (error) { @@ -60,7 +54,6 @@ pdf_load_embedded_cmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmobj) } else if (fz_is_indirect(obj)) { - pdf_log_font("usecmap (%d %d R)\n", fz_to_num(obj), fz_to_gen(obj)); error = pdf_load_embedded_cmap(&usecmap, xref, obj); if (error) { @@ -71,8 +64,6 @@ pdf_load_embedded_cmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmobj) pdf_drop_cmap(usecmap); } - pdf_log_font("}\n"); - pdf_store_item(xref->store, pdf_keep_cmap, pdf_drop_cmap, stmobj, cmap); *cmapp = cmap; @@ -110,8 +101,6 @@ pdf_load_system_cmap(pdf_cmap **cmapp, char *cmap_name) pdf_cmap *usecmap; pdf_cmap *cmap; - pdf_log_font("loading system cmap %s\n", cmap_name); - cmap = pdf_find_builtin_cmap(cmap_name); if (!cmap) return fz_throw("no builtin cmap file: %s", cmap_name); diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c index 26be83d4..a7b04166 100644 --- a/pdf/pdf_colorspace.c +++ b/pdf/pdf_colorspace.c @@ -8,8 +8,6 @@ load_icc_based(fz_colorspace **csp, pdf_xref *xref, fz_obj *dict) { int n; - pdf_log_rsrc("load ICCBased\n"); - n = fz_to_int(fz_dict_gets(dict, "N")); switch (n) @@ -104,8 +102,6 @@ load_separation(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) pdf_function *tint; int n; - pdf_log_rsrc("load Separation {\n"); - if (fz_is_array(nameobj)) n = fz_array_len(nameobj); else @@ -114,8 +110,6 @@ load_separation(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) if (n > FZ_MAX_COLORS) return fz_throw("too many components in colorspace"); - pdf_log_rsrc("n = %d\n", n); - error = pdf_load_colorspace(&base, xref, baseobj); if (error) return fz_rethrow(error, "cannot load base colorspace (%d %d R)", fz_to_num(baseobj), fz_to_gen(baseobj)); @@ -136,8 +130,6 @@ load_separation(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) cs->free_data = free_separation; cs->data = sep; - pdf_log_rsrc("}\n"); - *csp = cs; return fz_okay; } @@ -227,14 +219,10 @@ load_indexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) fz_colorspace *base; int i, n; - pdf_log_rsrc("load Indexed {\n"); - error = pdf_load_colorspace(&base, xref, baseobj); if (error) return fz_rethrow(error, "cannot load base colorspace (%d %d R)", fz_to_num(baseobj), fz_to_gen(baseobj)); - pdf_log_rsrc("base %s\n", base->name); - idx = fz_malloc(sizeof(struct indexed)); idx->base = base; idx->high = fz_to_int(highobj); @@ -250,11 +238,7 @@ load_indexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) if (fz_is_string(lookup) && fz_to_str_len(lookup) == n) { - unsigned char *buf; - - pdf_log_rsrc("string lookup\n"); - - buf = (unsigned char *) fz_to_str_buf(lookup); + unsigned char *buf = (unsigned char *) fz_to_str_buf(lookup); for (i = 0; i < n; i++) idx->lookup[i] = buf[i]; } @@ -262,8 +246,6 @@ load_indexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) { fz_stream *file; - pdf_log_rsrc("stream lookup\n"); - error = pdf_open_stream(&file, xref, fz_to_num(lookup), fz_to_gen(lookup)); if (error) { @@ -286,8 +268,6 @@ load_indexed(fz_colorspace **csp, pdf_xref *xref, fz_obj *array) return fz_throw("cannot parse colorspace lookup table"); } - pdf_log_rsrc("}\n"); - *csp = cs; return fz_okay; } diff --git a/pdf/pdf_debug.c b/pdf/pdf_debug.c deleted file mode 100644 index e2223b2d..00000000 --- a/pdf/pdf_debug.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "fitz.h" -#include "mupdf.h" - -/* - * Enable logging by setting environment variable MULOG to: - * (a)ll or a combination of - * (x)ref (r)src (f)ont (i)mage (s)hade (p)age - * - * eg. MULOG=fis ./x11pdf mytestfile.pdf - */ - -enum -{ - PDF_LXREF = 1, - PDF_LRSRC = 2, - PDF_LFONT = 4, - PDF_LIMAGE = 8, - PDF_LSHADE = 16, - PDF_LPAGE = 32 -}; - -static inline void pdflog(int tag, char *name, char *fmt, va_list ap) -{ - static int flags = 128; - static int level = 0; - static int push = 1; - int i; - - if (flags == 128) - { - char *s = getenv("MULOG"); - flags = 0; - if (s) - { - if (strstr(s, "a")) - flags |= 0xffff; - if (strstr(s, "x")) - flags |= PDF_LXREF; - if (strstr(s, "r")) - flags |= PDF_LRSRC; - if (strstr(s, "f")) - flags |= PDF_LFONT; - if (strstr(s, "i")) - flags |= PDF_LIMAGE; - if (strstr(s, "s")) - flags |= PDF_LSHADE; - if (strstr(s, "p")) - flags |= PDF_LPAGE; - } - } - - if (!(flags & tag)) - return; - - if (strchr(fmt, '}')) - level --; - - if (push) - { - printf("%s: ", name); - for (i = 0; i < level; i++) - printf("\t"); - } - - vprintf(fmt, ap); - - if (strchr(fmt, '{')) - level ++; - - push = !!strchr(fmt, '\n'); - - fflush(stdout); -} - -void pdf_log_xref(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LXREF,"xref",fmt,ap);va_end(ap);} - -void pdf_log_rsrc(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LRSRC,"rsrc",fmt,ap);va_end(ap);} - -void pdf_log_font(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LFONT,"font",fmt,ap);va_end(ap);} - -void pdf_log_image(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LIMAGE,"imag",fmt,ap);va_end(ap);} - -void pdf_log_shade(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LSHADE,"shad",fmt,ap);va_end(ap);} - -void pdf_log_page(char *fmt, ...) -{va_list ap;va_start(ap,fmt);pdflog(PDF_LPAGE,"page",fmt,ap);va_end(ap);} diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c index 73193707..e82502a1 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c @@ -86,7 +86,6 @@ enum { UNKNOWN, TYPE1, TRUETYPE }; static int ft_kind(FT_Face face) { const char *kind = FT_Get_X11_Font_Format(face); - pdf_log_font("ft font format %s\n", kind); if (!strcmp(kind, "TrueType")) return TRUETYPE; if (!strcmp(kind, "Type 1")) @@ -130,11 +129,8 @@ pdf_font_cid_to_gid(pdf_font_desc *fontdesc, int cid) static int ft_width(pdf_font_desc *fontdesc, int cid) { - int gid, fterr; - - gid = ft_cid_to_gid(fontdesc, cid); - - fterr = FT_Load_Glyph(fontdesc->font->ft_face, gid, + int gid = ft_cid_to_gid(fontdesc, cid); + int fterr = FT_Load_Glyph(fontdesc->font->ft_face, gid, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM); if (fterr) { @@ -168,8 +164,6 @@ pdf_load_builtin_font(pdf_font_desc *fontdesc, char *fontname) if (!data) return fz_throw("cannot find font: '%s'", fontname); - pdf_log_font("load builtin font %s\n", fontname); - error = fz_new_font_from_memory(&fontdesc->font, data, len, 0); if (error) return fz_rethrow(error, "cannot load freetype font from memory"); @@ -189,8 +183,6 @@ pdf_load_builtin_cjk_font(pdf_font_desc *fontdesc, int ros, int gothic) unsigned char *data; unsigned int len; - pdf_log_font("loading builtin CJK font\n"); - data = pdf_find_builtin_cjk_font(ros, gothic, &len); if (!data) return fz_throw("cannot find builtin CJK font"); @@ -233,9 +225,6 @@ pdf_load_system_font(pdf_font_desc *fontdesc, char *fontname, char *collection) if (fontdesc->flags & PDF_FD_FORCE_BOLD) isbold = 1; - pdf_log_font("fixed-%d serif-%d italic-%d script-%d bold-%d\n", - isfixed, isserif, isitalic, isscript, isbold); - if (collection) { if (!strcmp(collection, "Adobe-CNS1")) @@ -303,8 +292,6 @@ pdf_load_embedded_font(pdf_font_desc *fontdesc, pdf_xref *xref, fz_obj *stmref) fz_error error; fz_buffer *buf; - pdf_log_font("load embedded font\n"); - error = pdf_load_stream(&buf, xref, fz_to_num(stmref), fz_to_gen(stmref)); if (error) return fz_rethrow(error, "cannot load font stream (%d %d R)", fz_to_num(stmref), fz_to_gen(stmref)); @@ -414,7 +401,7 @@ pdf_new_font_desc(void) */ static fz_error -load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) +pdf_load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) { fz_error error; fz_obj *descriptor; @@ -441,9 +428,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) fontdesc = pdf_new_font_desc(); - pdf_log_font("load simple font (%d %d R) ptr=%p {\n", fz_to_num(dict), fz_to_gen(dict), fontdesc); - pdf_log_font("basefont %s -> %s\n", basefont, fontname); - descriptor = fz_dict_gets(dict, "FontDescriptor"); if (descriptor) error = pdf_load_font_descriptor(fontdesc, xref, descriptor, NULL, basefont); @@ -493,8 +477,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) /* Encoding */ - pdf_log_font("ft name '%s' '%s'\n", face->family_name, face->style_name); - symbolic = fontdesc->flags & 4; if (face->num_charmaps > 0) @@ -579,7 +561,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) /* encode by glyph name where we can */ if (kind == TYPE1) { - pdf_log_font("encode type1/cff by strings\n"); for (i = 0; i < 256; i++) { if (estrings[i]) @@ -607,7 +588,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) /* Unicode cmap */ if (!symbolic && face->charmap && face->charmap->platform_id == 3) { - pdf_log_font("encode truetype via unicode\n"); for (i = 0; i < 256; i++) { if (estrings[i]) @@ -624,7 +604,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) /* MacRoman cmap */ else if (!symbolic && face->charmap && face->charmap->platform_id == 1) { - pdf_log_font("encode truetype via macroman\n"); for (i = 0; i < 256; i++) { if (estrings[i]) @@ -641,7 +620,6 @@ load_simple_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) /* Symbolic cmap */ else { - pdf_log_font("encode truetype symbolic\n"); for (i = 0; i < 256; i++) { if (estrings[i]) @@ -718,8 +696,6 @@ skip_encoding: pdf_end_hmtx(fontdesc); - pdf_log_font("}\n"); - *fontdescp = fontdesc; return fz_okay; @@ -781,10 +757,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e fontdesc = pdf_new_font_desc(); - pdf_log_font("load cid font (%d %d R) ptr=%p {\n", fz_to_num(dict), fz_to_gen(dict), fontdesc); - pdf_log_font("basefont %s\n", basefont); - pdf_log_font("collection %s\n", collection); - descriptor = fz_dict_gets(dict, "FontDescriptor"); if (descriptor) error = pdf_load_font_descriptor(fontdesc, xref, descriptor, collection, basefont); @@ -800,10 +772,7 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e if (kind == TRUETYPE) { if (FT_IS_TRICKY(face) || is_dynalab(fontdesc->font->name)) - { fontdesc->font->ft_hint = 1; - pdf_log_font("forced hinting for dynalab font\n"); - } } /* Encoding */ @@ -811,7 +780,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e error = fz_okay; if (fz_is_name(encoding)) { - pdf_log_font("encoding /%s\n", fz_to_name(encoding)); if (!strcmp(fz_to_name(encoding), "Identity-H")) fontdesc->encoding = pdf_new_identity_cmap(0, 2); else if (!strcmp(fz_to_name(encoding), "Identity-V")) @@ -821,7 +789,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e } else if (fz_is_indirect(encoding)) { - pdf_log_font("encoding %d %d R\n", fz_to_num(encoding), fz_to_gen(encoding)); error = pdf_load_embedded_cmap(&fontdesc->encoding, xref, encoding); } else @@ -832,7 +799,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e goto cleanup; pdf_set_font_wmode(fontdesc, pdf_get_wmode(fontdesc->encoding)); - pdf_log_font("wmode %d\n", pdf_get_wmode(fontdesc->encoding)); if (kind == TRUETYPE) { @@ -843,8 +809,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e { fz_buffer *buf; - pdf_log_font("cidtogidmap stream\n"); - error = pdf_load_stream(&buf, xref, fz_to_num(cidtogidmap), fz_to_gen(cidtogidmap)); if (error) goto cleanup; @@ -862,8 +826,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e /* unicode cmap to get a glyph id */ else if (fontdesc->font->ft_substitute) { - pdf_log_font("emulate ttf cidfont\n"); - fterr = FT_Select_Charmap(face, ft_encoding_unicode); if (fterr) { @@ -985,8 +947,6 @@ load_cid_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict, fz_obj *e pdf_end_vmtx(fontdesc); } - pdf_log_font("}\n"); - *fontdescp = fontdesc; return fz_okay; @@ -996,7 +956,7 @@ cleanup: } static fz_error -load_type0_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) +pdf_load_type0_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *dict) { fz_error error; fz_obj *dfonts; @@ -1039,16 +999,12 @@ pdf_load_font_descriptor(pdf_font_desc *fontdesc, pdf_xref *xref, fz_obj *dict, char *fontname; char *origname; - pdf_log_font("load fontdescriptor {\n"); - if (!strchr(basefont, ',') || strchr(basefont, '+')) origname = fz_to_name(fz_dict_gets(dict, "FontName")); else origname = basefont; fontname = clean_font_name(origname); - pdf_log_font("fontname %s -> %s\n", origname, fontname); - fontdesc->flags = fz_to_int(fz_dict_gets(dict, "Flags")); fontdesc->italic_angle = fz_to_real(fz_dict_gets(dict, "ItalicAngle")); fontdesc->ascent = fz_to_real(fz_dict_gets(dict, "Ascent")); @@ -1057,16 +1013,11 @@ pdf_load_font_descriptor(pdf_font_desc *fontdesc, pdf_xref *xref, fz_obj *dict, fontdesc->x_height = fz_to_real(fz_dict_gets(dict, "XHeight")); fontdesc->missing_width = fz_to_real(fz_dict_gets(dict, "MissingWidth")); - pdf_log_font("flags %d\n", fontdesc->flags); - obj1 = fz_dict_gets(dict, "FontFile"); obj2 = fz_dict_gets(dict, "FontFile2"); obj3 = fz_dict_gets(dict, "FontFile3"); obj = obj1 ? obj1 : obj2 ? obj2 : obj3; - if (getenv("NOFONT")) - obj = NULL; - if (fz_is_indirect(obj)) { error = pdf_load_embedded_font(fontdesc, xref, obj); @@ -1093,8 +1044,6 @@ pdf_load_font_descriptor(pdf_font_desc *fontdesc, pdf_xref *xref, fz_obj *dict, fz_strlcpy(fontdesc->font->name, fontname, sizeof fontdesc->font->name); - pdf_log_font("}\n"); - return fz_okay; } @@ -1152,13 +1101,13 @@ pdf_load_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj *di charprocs = fz_dict_gets(dict, "CharProcs"); if (subtype && !strcmp(subtype, "Type0")) - error = load_type0_font(fontdescp, xref, dict); + error = pdf_load_type0_font(fontdescp, xref, dict); else if (subtype && !strcmp(subtype, "Type1")) - error = load_simple_font(fontdescp, xref, dict); + error = pdf_load_simple_font(fontdescp, xref, dict); else if (subtype && !strcmp(subtype, "MMType1")) - error = load_simple_font(fontdescp, xref, dict); + error = pdf_load_simple_font(fontdescp, xref, dict); else if (subtype && !strcmp(subtype, "TrueType")) - error = load_simple_font(fontdescp, xref, dict); + error = pdf_load_simple_font(fontdescp, xref, dict); else if (subtype && !strcmp(subtype, "Type3")) error = pdf_load_type3_font(fontdescp, xref, rdb, dict); else if (charprocs) @@ -1169,12 +1118,12 @@ pdf_load_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_obj *di else if (dfonts) { fz_warn("unknown font format, guessing type0."); - error = load_type0_font(fontdescp, xref, dict); + error = pdf_load_type0_font(fontdescp, xref, dict); } else { fz_warn("unknown font format, guessing type1 or truetype."); - error = load_simple_font(fontdescp, xref, dict); + error = pdf_load_simple_font(fontdescp, xref, dict); } if (error) return fz_rethrow(error, "cannot load font (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c index 392b5c19..c08c5e5b 100644 --- a/pdf/pdf_function.c +++ b/pdf/pdf_function.c @@ -835,8 +835,6 @@ load_postscript_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int tok; int len; - pdf_log_rsrc("load postscript function (%d %d R)\n", num, gen); - error = pdf_open_stream(&stream, xref, num, gen); if (error) return fz_rethrow(error, "cannot open calculator function stream"); @@ -907,8 +905,6 @@ load_sample_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int int bps; int i; - pdf_log_rsrc("sampled function {\n"); - func->u.sa.samples = NULL; obj = fz_dict_gets(dict, "Size"); @@ -922,8 +918,6 @@ load_sample_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int return fz_throw("malformed /BitsPerSample"); func->u.sa.bps = bps = fz_to_int(obj); - pdf_log_rsrc("bps %d\n", bps); - obj = fz_dict_gets(dict, "Encode"); if (fz_is_array(obj)) { @@ -967,8 +961,6 @@ load_sample_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int for (i = 0, samplecount = func->n; i < func->m; i++) samplecount *= func->u.sa.size[i]; - pdf_log_rsrc("samplecount %d\n", samplecount); - func->u.sa.samples = fz_calloc(samplecount, sizeof(float)); error = pdf_open_stream(&stream, xref, num, gen); @@ -1022,8 +1014,6 @@ load_sample_func(pdf_function *func, pdf_xref *xref, fz_obj *dict, int num, int fz_close(stream); - pdf_log_rsrc("}\n"); - return fz_okay; } @@ -1124,8 +1114,6 @@ load_exponential_func(pdf_function *func, fz_obj *dict) fz_obj *obj; int i; - pdf_log_rsrc("exponential function {\n"); - if (func->m != 1) return fz_throw("/Domain must be one dimension (%d)", func->m); @@ -1133,7 +1121,6 @@ load_exponential_func(pdf_function *func, fz_obj *dict) if (!fz_is_int(obj) && !fz_is_real(obj)) return fz_throw("malformed /N"); func->u.e.n = fz_to_real(obj); - pdf_log_rsrc("n %g\n", func->u.e.n); obj = fz_dict_gets(dict, "C0"); if (fz_is_array(obj)) @@ -1143,7 +1130,6 @@ load_exponential_func(pdf_function *func, fz_obj *dict) return fz_throw("exponential function result array out of range"); for (i = 0; i < func->n; i++) func->u.e.c0[i] = fz_to_real(fz_array_get(obj, i)); - pdf_log_rsrc("c0 %d\n", func->n); } else { @@ -1158,7 +1144,6 @@ load_exponential_func(pdf_function *func, fz_obj *dict) return fz_throw("/C1 must match /C0 length"); for (i = 0; i < func->n; i++) func->u.e.c1[i] = fz_to_real(fz_array_get(obj, i)); - pdf_log_rsrc("c1 %d\n", func->n); } else { @@ -1167,8 +1152,6 @@ load_exponential_func(pdf_function *func, fz_obj *dict) func->u.e.c1[0] = 1; } - pdf_log_rsrc("}\n"); - return fz_okay; } @@ -1212,8 +1195,6 @@ load_stitching_func(pdf_function *func, pdf_xref *xref, fz_obj *dict) int k; int i; - pdf_log_rsrc("stitching {\n"); - func->u.st.k = 0; if (func->m != 1) @@ -1225,8 +1206,6 @@ load_stitching_func(pdf_function *func, pdf_xref *xref, fz_obj *dict) { k = fz_array_len(obj); - pdf_log_rsrc("k %d\n", k); - func->u.st.funcs = fz_calloc(k, sizeof(pdf_function*)); func->u.st.bounds = fz_calloc(k - 1, sizeof(float)); func->u.st.encode = fz_calloc(k * 2, sizeof(float)); @@ -1284,8 +1263,6 @@ load_stitching_func(pdf_function *func, pdf_xref *xref, fz_obj *dict) } } - pdf_log_rsrc("}\n"); - return fz_okay; } @@ -1384,8 +1361,6 @@ pdf_load_function(pdf_function **funcp, pdf_xref *xref, fz_obj *dict) return fz_okay; } - pdf_log_rsrc("load function (%d %d R) {\n", fz_to_num(dict), fz_to_gen(dict)); - func = fz_malloc(sizeof(pdf_function)); memset(func, 0, sizeof(pdf_function)); func->refs = 1; @@ -1393,8 +1368,6 @@ pdf_load_function(pdf_function **funcp, pdf_xref *xref, fz_obj *dict) obj = fz_dict_gets(dict, "FunctionType"); func->type = fz_to_int(obj); - pdf_log_rsrc("type %d\n", func->type); - /* required for all */ obj = fz_dict_gets(dict, "Domain"); func->m = fz_array_len(obj) / 2; @@ -1403,7 +1376,6 @@ pdf_load_function(pdf_function **funcp, pdf_xref *xref, fz_obj *dict) func->domain[i][0] = fz_to_real(fz_array_get(obj, i * 2 + 0)); func->domain[i][1] = fz_to_real(fz_array_get(obj, i * 2 + 1)); } - pdf_log_rsrc("domain %d\n", func->m); /* required for type0 and type4, optional otherwise */ obj = fz_dict_gets(dict, "Range"); @@ -1416,7 +1388,6 @@ pdf_load_function(pdf_function **funcp, pdf_xref *xref, fz_obj *dict) func->range[i][0] = fz_to_real(fz_array_get(obj, i * 2 + 0)); func->range[i][1] = fz_to_real(fz_array_get(obj, i * 2 + 1)); } - pdf_log_rsrc("range %d\n", func->n); } else { @@ -1473,8 +1444,6 @@ pdf_load_function(pdf_function **funcp, pdf_xref *xref, fz_obj *dict) return fz_throw("unknown function type (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); } - pdf_log_rsrc("}\n"); - pdf_store_item(xref->store, pdf_keep_function, pdf_drop_function, dict, func); *funcp = func; diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c index 0b2f2547..fbd88f01 100644 --- a/pdf/pdf_image.c +++ b/pdf/pdf_image.c @@ -219,8 +219,6 @@ pdf_load_image_imp(fz_pixmap **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, p[i] = ~p[i]; } - pdf_log_image("size %dx%d n=%d bpc=%d imagemask=%d indexed=%d\n", w, h, n, bpc, imagemask, indexed); - /* Unpack samples into pixmap */ tile = fz_new_pixmap(colorspace, 0, 0, w, h); @@ -273,14 +271,10 @@ pdf_load_inline_image(fz_pixmap **pixp, pdf_xref *xref, fz_obj *rdb, fz_obj *dic { fz_error error; - pdf_log_image("load inline image {\n"); - error = pdf_load_image_imp(pixp, xref, rdb, dict, file, 0); if (error) return fz_rethrow(error, "cannot load inline image"); - pdf_log_image("}\n"); - return fz_okay; } @@ -308,8 +302,6 @@ pdf_load_jpx_image(fz_pixmap **imgp, pdf_xref *xref, fz_obj *dict) fz_pixmap *img; fz_obj *obj; - pdf_log_image("jpeg2000\n"); - colorspace = NULL; error = pdf_load_stream(&buf, xref, fz_to_num(dict), fz_to_gen(dict)); @@ -363,15 +355,11 @@ pdf_load_image(fz_pixmap **pixp, pdf_xref *xref, fz_obj *dict) return fz_okay; } - pdf_log_image("load image (%d 0 R) {\n", fz_to_num(dict)); - error = pdf_load_image_imp(pixp, xref, NULL, dict, NULL, 0); if (error) return fz_rethrow(error, "cannot load image (%d 0 R)", fz_to_num(dict)); pdf_store_item(xref->store, fz_keep_pixmap, fz_drop_pixmap, dict, *pixp); - pdf_log_image("}\n"); - return fz_okay; } diff --git a/pdf/pdf_outline.c b/pdf/pdf_outline.c index 829bfa8b..4f81bb9b 100644 --- a/pdf/pdf_outline.c +++ b/pdf/pdf_outline.c @@ -17,39 +17,24 @@ pdf_load_outline_imp(pdf_xref *xref, fz_obj *dict) node->next = NULL; node->count = 0; - pdf_log_page("load outline {\n"); - obj = fz_dict_gets(dict, "Title"); if (obj) - { node->title = pdf_to_utf8(obj); - pdf_log_page("title %s\n", node->title); - } obj = fz_dict_gets(dict, "Count"); if (obj) - { node->count = fz_to_int(obj); - } if (fz_dict_gets(dict, "Dest") || fz_dict_gets(dict, "A")) - { node->link = pdf_load_link(xref, dict); - } obj = fz_dict_gets(dict, "First"); if (obj) - { node->child = pdf_load_outline_imp(xref, obj); - } - - pdf_log_page("}\n"); obj = fz_dict_gets(dict, "Next"); if (obj) - { node->next = pdf_load_outline_imp(xref, obj); - } return node; } @@ -57,25 +42,15 @@ pdf_load_outline_imp(pdf_xref *xref, fz_obj *dict) pdf_outline * pdf_load_outline(pdf_xref *xref) { - pdf_outline *node; fz_obj *root, *obj, *first; - pdf_log_page("load outlines {\n"); - - node = NULL; - root = fz_dict_gets(xref->trailer, "Root"); obj = fz_dict_gets(root, "Outlines"); - if (obj) - { - first = fz_dict_gets(obj, "First"); - if (first) - node = pdf_load_outline_imp(xref, first); - } + first = fz_dict_gets(obj, "First"); + if (first) + return pdf_load_outline_imp(xref, first); - pdf_log_page("}\n"); - - return node; + return NULL; } void diff --git a/pdf/pdf_page.c b/pdf/pdf_page.c index 39cae41d..24f63d51 100644 --- a/pdf/pdf_page.c +++ b/pdf/pdf_page.c @@ -215,8 +215,6 @@ pdf_load_page_contents_array(fz_buffer **bigbufp, pdf_xref *xref, fz_obj *list) fz_buffer *one; int i; - pdf_log_page("multiple content streams: %d\n", fz_array_len(list)); - /* TODO: openstream, read, close into big buffer at once */ big = fz_new_buffer(32 * 1024); @@ -283,8 +281,6 @@ pdf_load_page(pdf_page **pagep, pdf_xref *xref, int number) if (number < 0 || number >= xref->page_len) return fz_throw("cannot find page %d", number + 1); - pdf_log_page("load page {\n"); - /* Ensure that we have a store for resource objects */ if (!xref->store) xref->store = pdf_new_store(); @@ -329,9 +325,6 @@ pdf_load_page(pdf_page **pagep, pdf_xref *xref, int number) page->rotate = fz_to_int(fz_dict_gets(dict, "Rotate")); - pdf_log_page("bbox [%d %d %d %d]\n", bbox.x0, bbox.y0, bbox.x1, bbox.y1); - pdf_log_page("rotate %d\n", page->rotate); - obj = fz_dict_gets(dict, "Annots"); if (obj) { @@ -354,8 +347,6 @@ pdf_load_page(pdf_page **pagep, pdf_xref *xref, int number) if (page->resources && pdf_resources_use_blending(page->resources)) page->transparency = 1; - pdf_log_page("} %p\n", page); - *pagep = page; return fz_okay; } @@ -363,7 +354,6 @@ pdf_load_page(pdf_page **pagep, pdf_xref *xref, int number) void pdf_free_page(pdf_page *page) { - pdf_log_page("drop page %p\n", page); if (page->resources) fz_drop_obj(page->resources); if (page->contents) diff --git a/pdf/pdf_pattern.c b/pdf/pdf_pattern.c index ab464cfd..33d84c99 100644 --- a/pdf/pdf_pattern.c +++ b/pdf/pdf_pattern.c @@ -14,8 +14,6 @@ pdf_load_pattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict) return fz_okay; } - pdf_log_rsrc("load pattern (%d %d R) {\n", fz_to_num(dict), fz_to_gen(dict)); - pat = fz_malloc(sizeof(pdf_pattern)); pat->refs = 1; pat->resources = NULL; @@ -28,28 +26,15 @@ pdf_load_pattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict) pat->xstep = fz_to_real(fz_dict_gets(dict, "XStep")); pat->ystep = fz_to_real(fz_dict_gets(dict, "YStep")); - pdf_log_rsrc("mask %d\n", pat->ismask); - pdf_log_rsrc("xstep %g\n", pat->xstep); - pdf_log_rsrc("ystep %g\n", pat->ystep); - obj = fz_dict_gets(dict, "BBox"); pat->bbox = pdf_to_rect(obj); - pdf_log_rsrc("bbox [%g %g %g %g]\n", - pat->bbox.x0, pat->bbox.y0, - pat->bbox.x1, pat->bbox.y1); - obj = fz_dict_gets(dict, "Matrix"); if (obj) pat->matrix = pdf_to_matrix(obj); else pat->matrix = fz_identity; - pdf_log_rsrc("matrix [%g %g %g %g %g %g]\n", - pat->matrix.a, pat->matrix.b, - pat->matrix.c, pat->matrix.d, - pat->matrix.e, pat->matrix.f); - pat->resources = fz_dict_gets(dict, "Resources"); if (pat->resources) fz_keep_obj(pat->resources); @@ -62,8 +47,6 @@ pdf_load_pattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict) return fz_rethrow(error, "cannot load pattern stream (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); } - pdf_log_rsrc("}\n"); - *patp = pat; return fz_okay; } diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c index 45310fc6..07110c2d 100644 --- a/pdf/pdf_repair.c +++ b/pdf/pdf_repair.c @@ -203,8 +203,6 @@ pdf_repair_xref(pdf_xref *xref, char *buf, int bufsize) int next; int i, n; - pdf_log_xref("repairxref %p\n", xref); - fz_seek(xref->file, 0, 0); listlen = 0; @@ -262,8 +260,6 @@ pdf_repair_xref(pdf_xref *xref, char *buf, int bufsize) goto cleanup; } - pdf_log_xref("found object: (%d %d R)\n", num, gen); - if (listlen + 1 == listcap) { listcap = (listcap * 3) / 2; @@ -348,9 +344,6 @@ pdf_repair_xref(pdf_xref *xref, char *buf, int bufsize) /* corrected stream length */ if (list[i].stm_len >= 0) { - pdf_log_xref("correct stream length %d %d = %d\n", - list[i].num, list[i].gen, list[i].stm_len); - error = pdf_load_object(&dict, xref, list[i].num, list[i].gen); if (error) { diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c index 46392059..aded5154 100644 --- a/pdf/pdf_shade.c +++ b/pdf/pdf_shade.c @@ -375,8 +375,6 @@ pdf_load_function_based_shading(fz_shade *shade, pdf_xref *xref, fz_obj *dict, p float xn, yn; int i; - pdf_log_shade("load type1 (function-based) shading\n"); - x0 = y0 = 0; x1 = y1 = 1; obj = fz_dict_gets(dict, "Domain"); @@ -438,8 +436,6 @@ pdf_load_axial_shading(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int funcs, float x0, y0, x1, y1; struct vertex p1, p2; - pdf_log_shade("load type2 (axial) shading\n"); - obj = fz_dict_gets(dict, "Coords"); x0 = fz_to_real(fz_array_get(obj, 0)); y0 = fz_to_real(fz_array_get(obj, 1)); @@ -490,8 +486,6 @@ pdf_load_radial_shading(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int funcs float x0, y0, r0, x1, y1, r1; struct vertex p1, p2; - pdf_log_shade("load type3 (radial) shading\n"); - obj = fz_dict_gets(dict, "Coords"); x0 = fz_to_real(fz_array_get(obj, 0)); y0 = fz_to_real(fz_array_get(obj, 1)); @@ -617,8 +611,6 @@ pdf_load_type4_shade(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int flag; int i; - pdf_log_shade("load type4 (free-form triangle mesh) shading\n"); - pdf_load_mesh_params(xref, dict, &p); if (funcs > 0) @@ -683,8 +675,6 @@ pdf_load_type5_shade(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int ncomp; int i, k; - pdf_log_shade("load type5 (lattice-form triangle mesh) shading\n"); - pdf_load_mesh_params(xref, dict, &p); if (funcs > 0) @@ -735,8 +725,6 @@ pdf_load_type6_shade(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int ncomp; int i, k; - pdf_log_shade("load type6 (coons patch mesh) shading\n"); - pdf_load_mesh_params(xref, dict, &p); if (funcs > 0) @@ -855,8 +843,6 @@ pdf_load_type7_shade(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int ncomp; int i, k; - pdf_log_shade("load type7 (tensor-product patch mesh) shading\n"); - pdf_load_mesh_params(xref, dict, &p); if (funcs > 0) @@ -978,8 +964,6 @@ pdf_load_shading_dict(fz_shade **shadep, pdf_xref *xref, fz_obj *dict, fz_matrix int type; int i; - pdf_log_shade("load shading dict (%d %d R) {\n", fz_to_num(dict), fz_to_gen(dict)); - shade = fz_malloc(sizeof(fz_shade)); shade->refs = 1; shade->type = FZ_MESH; @@ -1013,12 +997,10 @@ pdf_load_shading_dict(fz_shade **shadep, pdf_xref *xref, fz_obj *dict, fz_matrix fz_drop_shade(shade); return fz_rethrow(error, "cannot load colorspace (%d %d R)", fz_to_num(obj), fz_to_gen(obj)); } - pdf_log_shade("colorspace %s\n", shade->colorspace->name); obj = fz_dict_gets(dict, "Background"); if (obj) { - pdf_log_shade("background\n"); shade->use_background = 1; for (i = 0; i < shade->colorspace->n; i++) shade->background[i] = fz_to_real(fz_array_get(obj, i)); @@ -1092,8 +1074,6 @@ pdf_load_shading_dict(fz_shade **shadep, pdf_xref *xref, fz_obj *dict, fz_matrix if (func[i]) pdf_drop_function(func[i]); - pdf_log_shade("}\n"); - *shadep = shade; return fz_okay; @@ -1124,19 +1104,11 @@ pdf_load_shading(fz_shade **shadep, pdf_xref *xref, fz_obj *dict) /* Type 2 pattern dictionary */ if (fz_dict_gets(dict, "PatternType")) { - pdf_log_shade("load shading pattern (%d %d R) {\n", fz_to_num(dict), fz_to_gen(dict)); - obj = fz_dict_gets(dict, "Matrix"); if (obj) - { mat = pdf_to_matrix(obj); - pdf_log_shade("matrix [%g %g %g %g %g %g]\n", - mat.a, mat.b, mat.c, mat.d, mat.e, mat.f); - } else - { mat = fz_identity; - } obj = fz_dict_gets(dict, "ExtGState"); if (obj) @@ -1154,8 +1126,6 @@ pdf_load_shading(fz_shade **shadep, pdf_xref *xref, fz_obj *dict) error = pdf_load_shading_dict(shadep, xref, obj, mat); if (error) return fz_rethrow(error, "cannot load shading dictionary (%d %d R)", fz_to_num(obj), fz_to_gen(obj)); - - pdf_log_shade("}\n"); } /* Naked shading dictionary */ diff --git a/pdf/pdf_store.c b/pdf/pdf_store.c index cccfc76c..a57f839a 100644 --- a/pdf/pdf_store.c +++ b/pdf/pdf_store.c @@ -53,7 +53,6 @@ pdf_store_item(pdf_store *store, void *keepfunc, void *drop_func, fz_obj *key, v if (fz_is_indirect(key)) { struct refkey refkey; - pdf_log_rsrc("store item (%d %d R) ptr=%p\n", fz_to_num(key), fz_to_gen(key), val); refkey.drop_func = drop_func; refkey.num = fz_to_num(key); refkey.gen = fz_to_gen(key); @@ -61,7 +60,6 @@ pdf_store_item(pdf_store *store, void *keepfunc, void *drop_func, fz_obj *key, v } else { - pdf_log_rsrc("store item (...) = %p\n", val); item->next = store->root; store->root = item; } diff --git a/pdf/pdf_type3.c b/pdf/pdf_type3.c index 4c22654b..ac2c56bc 100644 --- a/pdf/pdf_type3.c +++ b/pdf/pdf_type3.c @@ -25,24 +25,12 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o fontdesc = pdf_new_font_desc(); - pdf_log_font("load type3 font (%d %d R) ptr=%p {\n", fz_to_num(dict), fz_to_gen(dict), fontdesc); - pdf_log_font("name %s\n", buf); - obj = fz_dict_gets(dict, "FontMatrix"); matrix = pdf_to_matrix(obj); - pdf_log_font("matrix [%g %g %g %g %g %g]\n", - matrix.a, matrix.b, - matrix.c, matrix.d, - matrix.e, matrix.f); - obj = fz_dict_gets(dict, "FontBBox"); bbox = pdf_to_rect(obj); - pdf_log_font("bbox [%g %g %g %g]\n", - bbox.x0, bbox.y0, - bbox.x1, bbox.y1); - fontdesc->font = fz_new_type3_font(buf, matrix); fz_set_font_bbox(fontdesc->font, bbox.x0, bbox.y0, bbox.x1, bbox.y1); @@ -154,8 +142,6 @@ pdf_load_type3_font(pdf_font_desc **fontdescp, pdf_xref *xref, fz_obj *rdb, fz_o } } - pdf_log_font("}\n"); - *fontdescp = fontdesc; return fz_okay; diff --git a/pdf/pdf_unicode.c b/pdf/pdf_unicode.c index 01326b53..54cf9911 100644 --- a/pdf/pdf_unicode.c +++ b/pdf/pdf_unicode.c @@ -16,8 +16,6 @@ pdf_load_to_unicode(pdf_font_desc *font, pdf_xref *xref, if (pdf_is_stream(xref, fz_to_num(cmapstm), fz_to_gen(cmapstm))) { - pdf_log_font("to_unicode embedded cmap\n"); - error = pdf_load_embedded_cmap(&cmap, xref, cmapstm); if (error) return fz_rethrow(error, "cannot load embedded cmap (%d %d R)", fz_to_num(cmapstm), fz_to_gen(cmapstm)); @@ -44,8 +42,6 @@ pdf_load_to_unicode(pdf_font_desc *font, pdf_xref *xref, else if (collection) { - pdf_log_font("to_unicode cid collection (%s)\n", collection); - error = fz_okay; if (!strcmp(collection, "Adobe-CNS1")) @@ -65,8 +61,6 @@ pdf_load_to_unicode(pdf_font_desc *font, pdf_xref *xref, if (strings) { - pdf_log_font("to_unicode strings\n"); - /* TODO one-to-many mappings */ font->cid_to_ucs_len = 256; @@ -83,9 +77,8 @@ pdf_load_to_unicode(pdf_font_desc *font, pdf_xref *xref, if (!font->to_unicode && !font->cid_to_ucs) { - pdf_log_font("to_unicode could not be loaded\n"); /* TODO: synthesize a ToUnicode if it's a freetype font with - * cmap and/or post tables or if it has glyph names. */ + * cmap and/or post tables or if it has glyph names. */ } return fz_okay; diff --git a/pdf/pdf_xobject.c b/pdf/pdf_xobject.c index 86360d3a..6228377f 100644 --- a/pdf/pdf_xobject.c +++ b/pdf/pdf_xobject.c @@ -20,29 +20,18 @@ pdf_load_xobject(pdf_xobject **formp, pdf_xref *xref, fz_obj *dict) form->contents = NULL; form->colorspace = NULL; - pdf_log_rsrc("load xobject (%d %d R) ptr=%p {\n", fz_to_num(dict), fz_to_gen(dict), form); - /* Store item immediately, to avoid possible recursion if objects refer back to this one */ pdf_store_item(xref->store, pdf_keep_xobject, pdf_drop_xobject, dict, form); obj = fz_dict_gets(dict, "BBox"); form->bbox = pdf_to_rect(obj); - pdf_log_rsrc("bbox [%g %g %g %g]\n", - form->bbox.x0, form->bbox.y0, - form->bbox.x1, form->bbox.y1); - obj = fz_dict_gets(dict, "Matrix"); if (obj) form->matrix = pdf_to_matrix(obj); else form->matrix = fz_identity; - pdf_log_rsrc("matrix [%g %g %g %g %g %g]\n", - form->matrix.a, form->matrix.b, - form->matrix.c, form->matrix.d, - form->matrix.e, form->matrix.f); - form->isolated = 0; form->knockout = 0; form->transparency = 0; @@ -65,14 +54,9 @@ pdf_load_xobject(pdf_xobject **formp, pdf_xref *xref, fz_obj *dict) error = pdf_load_colorspace(&form->colorspace, xref, obj); if (error) fz_catch(error, "cannot load xobject colorspace"); - pdf_log_rsrc("colorspace %s\n", form->colorspace->name); } } - pdf_log_rsrc("isolated %d\n", form->isolated); - pdf_log_rsrc("knockout %d\n", form->knockout); - pdf_log_rsrc("transparency %d\n", form->transparency); - form->resources = fz_dict_gets(dict, "Resources"); if (form->resources) fz_keep_obj(form->resources); @@ -85,9 +69,6 @@ pdf_load_xobject(pdf_xobject **formp, pdf_xref *xref, fz_obj *dict) return fz_rethrow(error, "cannot load xobject content stream (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); } - pdf_log_rsrc("stream %d bytes\n", form->contents->len); - pdf_log_rsrc("}\n"); - *formp = form; return fz_okay; } diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index ce973d39..f93f7489 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -24,8 +24,6 @@ pdf_load_version(pdf_xref *xref) xref->version = atof(buf + 5) * 10; - pdf_log_xref("version %d.%d\n", xref->version / 10, xref->version % 10); - return fz_okay; } @@ -55,7 +53,6 @@ pdf_read_start_xref(pdf_xref *xref) while (iswhite(buf[i]) && i < n) i ++; xref->startxref = atoi((char*)(buf + i)); - pdf_log_xref("startxref %d\n", xref->startxref); return fz_okay; } } @@ -78,8 +75,6 @@ pdf_read_old_trailer(pdf_xref *xref, char *buf, int cap) int tok; int c; - pdf_log_xref("load old xref format trailer\n"); - fz_read_line(xref->file, buf, cap); if (strncmp(buf, "xref", 4) != 0) return fz_throw("cannot find xref marker"); @@ -130,9 +125,6 @@ static fz_error pdf_read_new_trailer(pdf_xref *xref, char *buf, int cap) { fz_error error; - - pdf_log_xref("load new xref format trailer\n"); - error = pdf_parse_ind_obj(&xref->trailer, xref, xref->file, buf, cap, NULL, NULL, NULL); if (error) return fz_rethrow(error, "cannot parse trailer (compressed)"); @@ -203,8 +195,6 @@ pdf_read_old_xref(fz_obj **trailerp, pdf_xref *xref, char *buf, int cap) int i; int c; - pdf_log_xref("load old xref format\n"); - fz_read_line(xref->file, buf, cap); if (strncmp(buf, "xref", 4) != 0) return fz_throw("cannot find xref marker"); @@ -322,8 +312,6 @@ pdf_read_new_xref(fz_obj **trailerp, pdf_xref *xref, char *buf, int cap) int size, w0, w1, w2; int t; - pdf_log_xref("load new xref format\n"); - error = pdf_parse_ind_obj(&trailer, xref, xref->file, buf, cap, &num, &gen, &stm_ofs); if (error) return fz_rethrow(error, "cannot parse compressed xref stream object"); @@ -347,8 +335,6 @@ pdf_read_new_xref(fz_obj **trailerp, pdf_xref *xref, char *buf, int cap) return fz_throw("object id (%d %d R) out of range (0..%d)", num, gen, xref->len - 1); } - pdf_log_xref("\tnum=%d gen=%d size=%d\n", num, gen, size); - obj = fz_dict_gets(trailer, "W"); if (!obj) { fz_drop_obj(trailer); @@ -448,7 +434,6 @@ pdf_read_xref_sections(pdf_xref *xref, int ofs, char *buf, int cap) xrefstm = fz_dict_gets(trailer, "XRefStm"); if (xrefstm) { - pdf_log_xref("load xrefstm\n"); error = pdf_read_xref_sections(xref, fz_to_int(xrefstm), buf, cap); if (error) { @@ -460,7 +445,6 @@ pdf_read_xref_sections(pdf_xref *xref, int ofs, char *buf, int cap) prev = fz_dict_gets(trailer, "Prev"); if (prev) { - pdf_log_xref("load prev at %#x\n", fz_to_int(prev)); error = pdf_read_xref_sections(xref, fz_to_int(prev), buf, cap); if (error) { @@ -500,8 +484,6 @@ pdf_load_xref(pdf_xref *xref, char *buf, int bufsize) if (!size) return fz_throw("trailer missing Size entry"); - pdf_log_xref("\tsize %d at %#x\n", fz_to_int(size), xref->startxref); - pdf_resize_xref(xref, fz_to_int(size)); error = pdf_read_xref_sections(xref, xref->startxref, buf, bufsize); @@ -542,8 +524,6 @@ pdf_open_xref_with_stream(pdf_xref **xrefp, fz_stream *file, char *password) memset(xref, 0, sizeof(pdf_xref)); - pdf_log_xref("openxref %p\n", xref); - xref->file = fz_keep_stream(file); error = pdf_load_xref(xref, xref->scratch, sizeof xref->scratch); @@ -627,7 +607,6 @@ pdf_open_xref_with_stream(pdf_xref **xrefp, fz_stream *file, char *password) obj = fz_dict_gets(dict, "Type"); if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Catalog")) { - pdf_log_xref("found catalog: (%d %d R)\n", i, 0); obj = fz_new_indirect(i, 0, xref); fz_dict_puts(xref->trailer, "Root", obj); fz_drop_obj(obj); @@ -638,7 +617,6 @@ pdf_open_xref_with_stream(pdf_xref **xrefp, fz_stream *file, char *password) { if (fz_dict_gets(dict, "Creator") || fz_dict_gets(dict, "Producer")) { - pdf_log_xref("found info: (%d %d R)\n", i, 0); obj = fz_new_indirect(i, 0, xref); fz_dict_puts(xref->trailer, "Info", obj); fz_drop_obj(obj); @@ -658,8 +636,6 @@ pdf_free_xref(pdf_xref *xref) { int i; - pdf_log_xref("freexref %p\n", xref); - if (xref->store) pdf_free_store(xref->store); @@ -735,8 +711,6 @@ pdf_load_obj_stm(pdf_xref *xref, int num, int gen, char *buf, int cap) int i, n; int tok; - pdf_log_xref("loadobjstm (%d %d R)\n", num, gen); - error = pdf_load_object(&objstm, xref, num, gen); if (error) return fz_rethrow(error, "cannot load object stream object (%d %d R)", num, gen); @@ -744,8 +718,6 @@ pdf_load_obj_stm(pdf_xref *xref, int num, int gen, char *buf, int cap) count = fz_to_int(fz_dict_gets(objstm, "N")); first = fz_to_int(fz_dict_gets(objstm, "First")); - pdf_log_xref("\tcount %d\n", count); - numbuf = fz_calloc(count, sizeof(int)); ofsbuf = fz_calloc(count, sizeof(int)); diff --git a/win32/libmupdf.vcproj b/win32/libmupdf.vcproj index 96023016..6785335c 100644 --- a/win32/libmupdf.vcproj +++ b/win32/libmupdf.vcproj @@ -183,10 +183,6 @@ > </File> <File - RelativePath="..\pdf\pdf_debug.c" - > - </File> - <File RelativePath="..\pdf\pdf_encoding.c" > </File> |