diff options
author | Tor Andersson <tor@ghostscript.com> | 2008-11-12 00:28:34 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2008-11-12 00:28:34 +0100 |
commit | 2e671dc68b2b80e3147a8248eea1d3e5363b79d9 (patch) | |
tree | c6f803c7e78c312f87e017394c1e8012bcfd7744 | |
parent | 54cb0b9c09e6ef1b01801a068c015b9997cb28ed (diff) | |
download | mupdf-2e671dc68b2b80e3147a8248eea1d3e5363b79d9.tar.xz |
Make object number printouts be more consistent.
-rw-r--r-- | mupdf/pdf_annot.c | 4 | ||||
-rw-r--r-- | mupdf/pdf_build.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_cmap.c | 4 | ||||
-rw-r--r-- | mupdf/pdf_doctor.c | 5 | ||||
-rw-r--r-- | mupdf/pdf_font.c | 4 | ||||
-rw-r--r-- | mupdf/pdf_function.c | 16 | ||||
-rw-r--r-- | mupdf/pdf_image.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_open.c | 8 | ||||
-rw-r--r-- | mupdf/pdf_page.c | 12 | ||||
-rw-r--r-- | mupdf/pdf_pagetree.c | 6 | ||||
-rw-r--r-- | mupdf/pdf_parse.c | 9 | ||||
-rw-r--r-- | mupdf/pdf_pattern.c | 6 | ||||
-rw-r--r-- | mupdf/pdf_repair.c | 4 | ||||
-rw-r--r-- | mupdf/pdf_resources.c | 26 | ||||
-rw-r--r-- | mupdf/pdf_save.c | 14 | ||||
-rw-r--r-- | mupdf/pdf_shade.c | 4 | ||||
-rw-r--r-- | mupdf/pdf_store.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_stream.c | 16 | ||||
-rw-r--r-- | mupdf/pdf_type3.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_xobject.c | 2 | ||||
-rw-r--r-- | mupdf/pdf_xref.c | 22 |
21 files changed, 88 insertions, 82 deletions
diff --git a/mupdf/pdf_annot.c b/mupdf/pdf_annot.c index 90b510ce..084122ef 100644 --- a/mupdf/pdf_annot.c +++ b/mupdf/pdf_annot.c @@ -103,7 +103,7 @@ pdf_loadlink(pdf_link **linkp, pdf_xref *xref, fz_obj *dict) if (error) return fz_rethrow(error, "cannot resolve /Dest"); dest = resolvedest(xref, obj); - pdf_logpage("dest %d %d R\n", fz_tonum(dest), fz_togen(dest)); + pdf_logpage("dest (%d %d R)\n", fz_tonum(dest), fz_togen(dest)); fz_dropobj(obj); } @@ -118,7 +118,7 @@ pdf_loadlink(pdf_link **linkp, pdf_xref *xref, fz_obj *dict) if (!strcmp(fz_toname(obj), "GoTo")) { dest = resolvedest(xref, fz_dictgets(action, "D")); - pdf_logpage("action goto %d %d R\n", fz_tonum(dest), fz_togen(dest)); + pdf_logpage("action goto (%d %d R)\n", fz_tonum(dest), fz_togen(dest)); } else if (!strcmp(fz_toname(obj), "URI")) { diff --git a/mupdf/pdf_build.c b/mupdf/pdf_build.c index 6acc71b5..741d5b72 100644 --- a/mupdf/pdf_build.c +++ b/mupdf/pdf_build.c @@ -778,7 +778,7 @@ cleanup: cleanupclip: if (clip) fz_dropnode((fz_node *)clip); - return fz_rethrow(error, reason); + return fz_rethrow(error, "%s", reason); } /* diff --git a/mupdf/pdf_cmap.c b/mupdf/pdf_cmap.c index fcef601f..b09d69fd 100644 --- a/mupdf/pdf_cmap.c +++ b/mupdf/pdf_cmap.c @@ -1074,7 +1074,7 @@ pdf_loadembeddedcmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmref) return fz_okay; } - pdf_logfont("load embedded cmap %d %d {\n", fz_tonum(stmref), fz_togen(stmref)); + pdf_logfont("load embedded cmap (%d %d R) {\n", fz_tonum(stmref), fz_togen(stmref)); error = pdf_resolve(&stmobj, xref); if (error) @@ -1118,7 +1118,7 @@ pdf_loadembeddedcmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *stmref) } else if (fz_isindirect(obj)) { - pdf_logfont("usecmap %d %d R\n", fz_tonum(obj), fz_togen(obj)); + pdf_logfont("usecmap (%d %d R)\n", fz_tonum(obj), fz_togen(obj)); error = pdf_loadembeddedcmap(&usecmap, xref, obj); if (error) { diff --git a/mupdf/pdf_doctor.c b/mupdf/pdf_doctor.c index 6c36391d..12ee46a1 100644 --- a/mupdf/pdf_doctor.c +++ b/mupdf/pdf_doctor.c @@ -46,12 +46,13 @@ sweepref(pdf_xref *xref, fz_obj *ref) { fz_error *error; fz_obj *obj; - int oid; + int oid, gid; oid = fz_tonum(ref); + gid = fz_tonum(ref); if (oid < 0 || oid >= xref->len) - return fz_throw("object out of range %d", oid); + return fz_throw("object out of range (%d %d R)", oid, gid); if (xref->table[oid].mark) return fz_okay; diff --git a/mupdf/pdf_font.c b/mupdf/pdf_font.c index c953ed1f..7ed7ef1c 100644 --- a/mupdf/pdf_font.c +++ b/mupdf/pdf_font.c @@ -351,7 +351,7 @@ loadsimplefont(pdf_font **fontp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) if (!font) return fz_outofmem; - pdf_logfont("load simple font %d %d (%p) {\n", fz_tonum(ref), fz_togen(ref), font); + pdf_logfont("load simple font (%d %d R) ptr=%p {\n", fz_tonum(ref), fz_togen(ref), font); pdf_logfont("basefont0 %s\n", basefont); pdf_logfont("basefont1 %s\n", fontname); @@ -677,7 +677,7 @@ loadcidfont(pdf_font **fontp, pdf_xref *xref, fz_obj *dict, fz_obj *ref, fz_obj if (!font) return fz_outofmem; - pdf_logfont("load cid font %d %d (%p) {\n", fz_tonum(ref), fz_togen(ref), font); + pdf_logfont("load cid font (%d %d R) ptr=%p {\n", fz_tonum(ref), fz_togen(ref), font); pdf_logfont("basefont %s\n", basefont); pdf_logfont("collection %s\n", collection); diff --git a/mupdf/pdf_function.c b/mupdf/pdf_function.c index 4791a3aa..2bcd174b 100644 --- a/mupdf/pdf_function.c +++ b/mupdf/pdf_function.c @@ -478,7 +478,7 @@ loadpostscriptfunc(pdf_function *func, pdf_xref *xref, fz_obj *dict, int oid, in fz_stream *stream; int codeptr; - pdf_logrsrc("load postscript function %d %d\n", oid, gen); + pdf_logrsrc("load postscript function (%d %d R)\n", oid, gen); error = pdf_openstream(&stream, xref, oid, gen); if (error) @@ -941,7 +941,7 @@ loadsamplefunc(pdf_function *func, pdf_xref *xref, fz_obj *dict, int oid, int ge int bps; int i; - pdf_logrsrc("sampled function {\n", oid, gen); + pdf_logrsrc("sampled function {\n"); func->u.sa.samples = nil; @@ -1449,7 +1449,7 @@ pdf_loadfunction(pdf_function **funcp, pdf_xref *xref, fz_obj *ref) return fz_okay; } - pdf_logrsrc("load function %d %d {\n", fz_tonum(ref), fz_togen(ref)); + pdf_logrsrc("load function (%d %d R) {\n", fz_tonum(ref), fz_togen(ref)); func = fz_malloc(sizeof(pdf_function)); if (!func) @@ -1515,7 +1515,7 @@ pdf_loadfunction(pdf_function **funcp, pdf_xref *xref, fz_obj *ref) { pdf_dropfunction(func); fz_dropobj(dict); - return fz_rethrow(error, "cannot load sampled function (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot load sampled function (%d %d R)", fz_tonum(ref), fz_togen(ref)); } break; @@ -1525,7 +1525,7 @@ pdf_loadfunction(pdf_function **funcp, pdf_xref *xref, fz_obj *ref) { pdf_dropfunction(func); fz_dropobj(dict); - return fz_rethrow(error, "cannot load exponential function (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot load exponential function (%d %d R)", fz_tonum(ref), fz_togen(ref)); } break; @@ -1535,7 +1535,7 @@ pdf_loadfunction(pdf_function **funcp, pdf_xref *xref, fz_obj *ref) { pdf_dropfunction(func); fz_dropobj(dict); - return fz_rethrow(error, "cannot load stitching function (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot load stitching function (%d %d R)", fz_tonum(ref), fz_togen(ref)); } break; @@ -1545,14 +1545,14 @@ pdf_loadfunction(pdf_function **funcp, pdf_xref *xref, fz_obj *ref) { pdf_dropfunction(func); fz_dropobj(dict); - return fz_rethrow(error, "cannot load calculator function (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot load calculator function (%d %d R)", fz_tonum(ref), fz_togen(ref)); } break; default: fz_free(func); fz_dropobj(dict); - return fz_throw("unknown function type %d (function %d)", func->type, fz_tonum(ref)); + return fz_throw("unknown function type %d (%d %d R)", func->type, fz_tonum(ref), fz_togen(ref)); } fz_dropobj(dict); diff --git a/mupdf/pdf_image.c b/mupdf/pdf_image.c index 71cc932d..b8cd6edf 100644 --- a/mupdf/pdf_image.c +++ b/mupdf/pdf_image.c @@ -231,7 +231,7 @@ pdf_loadimage(pdf_image **imgp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) if (!img) return fz_throw("outofmem: image struct"); - pdf_logimage("load image %d %d (%p) {\n", fz_tonum(ref), fz_togen(ref), img); + pdf_logimage("load image (%d %d R) ptr=%p {\n", fz_tonum(ref), fz_togen(ref), img); /* * Dimensions, BPC and ColorSpace diff --git a/mupdf/pdf_open.c b/mupdf/pdf_open.c index 1ebe49ec..f4cc3e91 100644 --- a/mupdf/pdf_open.c +++ b/mupdf/pdf_open.c @@ -369,13 +369,13 @@ readnewxref(fz_obj **trailerp, pdf_xref *xref, char *buf, int cap) if (oid == xref->len && oid < xref->cap) { /* allow broken pdf files that have off-by-one errors in the xref */ - fz_warn("object id (%d) out of range (0..%d)", oid, xref->len - 1); + fz_warn("object id (%d %d R) out of range (0..%d)", oid, gen, xref->len - 1); xref->len ++; } else { fz_dropobj(trailer); - return fz_throw("object id (%d) out of range (0..%d)", oid, xref->len - 1); + return fz_throw("object id (%d %d R) out of range (0..%d)", oid, gen, xref->len - 1); } } @@ -538,7 +538,7 @@ pdf_loadobjstm(pdf_xref *xref, int oid, int gen, char *buf, int cap) int i, n; pdf_token_e tok; - pdf_logxref("loadobjstm %d %d\n", oid, gen); + pdf_logxref("loadobjstm (%d %d R)\n", oid, gen); error = pdf_loadobject(&objstm, xref, oid, gen); if (error) @@ -609,7 +609,7 @@ pdf_loadobjstm(pdf_xref *xref, int oid, int gen, char *buf, int cap) if (oidbuf[i] < 1 || oidbuf[i] >= xref->len) { - error = fz_throw("object id (%d) out of range (0..%d)", oidbuf[i], xref->len - 1); + error = fz_throw("object id (%d 0 R) out of range (0..%d)", oidbuf[i], xref->len - 1); goto cleanupstm; } diff --git a/mupdf/pdf_page.c b/mupdf/pdf_page.c index b83d0e0f..65dd532c 100644 --- a/mupdf/pdf_page.c +++ b/mupdf/pdf_page.c @@ -11,14 +11,14 @@ runone(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, fz_obj *stmref) error = pdf_openstream(&stm, xref, fz_tonum(stmref), fz_togen(stmref)); if (error) - return fz_rethrow(error, "cannot open content stream %d", fz_tonum(stmref)); + return fz_rethrow(error, "cannot open content stream (%d %d R)", fz_tonum(stmref), fz_togen(stmref)); error = pdf_runcsi(csi, xref, rdb, stm); fz_dropstream(stm); if (error) - return fz_rethrow(error, "cannot interpret content stream %d", fz_tonum(stmref)); + return fz_rethrow(error, "cannot interpret content stream (%d %d R)", fz_tonum(stmref), fz_togen(stmref)); return fz_okay; } @@ -57,7 +57,7 @@ runmany(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, fz_obj *list) error = pdf_loadstream(&one, xref, fz_tonum(stm), fz_togen(stm)); if (error) { - error = fz_rethrow(error, "cannot load content stream"); + error = fz_rethrow(error, "cannot load content stream part %d/%d", i + 1, fz_arraylen(list)); goto cleanupstm; } @@ -121,7 +121,7 @@ loadpagecontents(fz_tree **treep, pdf_xref *xref, fz_obj *rdb, fz_obj *ref) { error = pdf_loadindirect(&obj, xref, ref); if (error) - return fz_rethrow(error, "cannot load page contents (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot load page contents (%d %d R)", fz_tonum(ref), fz_togen(ref)); if (fz_isarray(obj)) { @@ -138,7 +138,7 @@ loadpagecontents(fz_tree **treep, pdf_xref *xref, fz_obj *rdb, fz_obj *ref) if (error) { pdf_dropcsi(csi); - return fz_rethrow(error, "cannot interpret page contents (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot interpret page contents (%d %d R)", fz_tonum(ref), fz_togen(ref)); } } @@ -152,7 +152,7 @@ loadpagecontents(fz_tree **treep, pdf_xref *xref, fz_obj *rdb, fz_obj *ref) if (error) { pdf_dropcsi(csi); - return fz_rethrow(error, "cannot interpret page contents (%d)", fz_tonum(ref)); + return fz_rethrow(error, "cannot interpret page contents (%d %d R)", fz_tonum(ref), fz_togen(ref)); } } diff --git a/mupdf/pdf_pagetree.c b/mupdf/pdf_pagetree.c index 6333a9bd..f46cb508 100644 --- a/mupdf/pdf_pagetree.c +++ b/mupdf/pdf_pagetree.c @@ -24,7 +24,7 @@ loadpagetree(pdf_xref *xref, pdf_pagetree *pages, if (strcmp(fz_toname(type), "Page") == 0) { - pdf_logpage("page %d, %d %d\n", *pagenum, ref->u.r.oid, ref->u.r.gid); + pdf_logpage("page %d (%d %d R)\n", *pagenum, ref->u.r.oid, ref->u.r.gid); (*pagenum)++; if (inherit.resources && !fz_dictgets(obj, "Resources")) @@ -79,7 +79,7 @@ loadpagetree(pdf_xref *xref, pdf_pagetree *pages, if (error) return fz_rethrow(error, "cannot resolve /Kids"); - pdf_logpage("subtree %d pages, %d %d {\n", + pdf_logpage("subtree %d pages (%d %d R) {\n", fz_arraylen(kids), ref->u.r.oid, ref->u.r.gid); for (i = 0; i < fz_arraylen(kids); i++) @@ -160,7 +160,7 @@ pdf_loadpagetree(pdf_pagetree **pp, pdf_xref *xref) p = fz_malloc(sizeof(pdf_pagetree)); if (!p) { error = fz_throw("outofmem: page tree struct"); goto cleanup; } - pdf_logpage("load pagetree %d pages, %d %d (%p) {\n", count, treeref->u.r.oid, treeref->u.r.gid, p); + pdf_logpage("load pagetree %d pages (%d %d R) ptr=%p {\n", count, treeref->u.r.oid, treeref->u.r.gid, p); p->pref = nil; p->pobj = nil; diff --git a/mupdf/pdf_parse.c b/mupdf/pdf_parse.c index 11bd24d6..9f30e061 100644 --- a/mupdf/pdf_parse.c +++ b/mupdf/pdf_parse.c @@ -432,7 +432,7 @@ skip: { c = fz_peekbyte(file); if (c != '\n') - fz_warn("syntaxerror: corrupt pdf stream (%d %d)\n", oid, gid); + fz_warn("syntaxerror: corrupt pdf stream (%d %d R)\n", oid, gid); else c = fz_readbyte(file); } @@ -444,7 +444,10 @@ skip: else if (tok == PDF_TENDOBJ) stmofs = 0; else + { + error = fz_throw("expected endobj or stream keyword"); goto cleanup; + } if (ooid) *ooid = oid; if (ogid) *ogid = gid; @@ -456,7 +459,7 @@ cleanup: if (obj) fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot parse indirect object (%d %d)", oid, gid); - return fz_throw("cannot parse indirect object (%d %d)", oid, gid); + return fz_rethrow(error, "cannot parse indirect object (%d %d R)", oid, gid); + return fz_throw("cannot parse indirect object (%d %d R)", oid, gid); } diff --git a/mupdf/pdf_pattern.c b/mupdf/pdf_pattern.c index cbf316fb..0a200a72 100644 --- a/mupdf/pdf_pattern.c +++ b/mupdf/pdf_pattern.c @@ -35,7 +35,7 @@ pdf_loadpattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict, fz_obj *stmref return fz_okay; } - pdf_logrsrc("load pattern %d %d {\n", fz_tonum(stmref), fz_togen(stmref)); + pdf_logrsrc("load pattern (%d %d R) {\n", fz_tonum(stmref), fz_togen(stmref)); pat = fz_malloc(sizeof(pdf_pattern)); if (!pat) @@ -120,7 +120,7 @@ pdf_loadpattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict, fz_obj *stmref error = pdf_openstream(&stm, xref, fz_tonum(stmref), fz_togen(stmref)); if (error) { - error = fz_rethrow(error, "cannot open pattern stream %d", fz_tonum(stmref)); + error = fz_rethrow(error, "cannot open pattern stream (%d %d R)", fz_tonum(stmref), fz_togen(stmref)); goto cleanupcsi; } @@ -130,7 +130,7 @@ pdf_loadpattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *dict, fz_obj *stmref if (error) { - error = fz_rethrow(error, "cannot interpret pattern stream %d", fz_tonum(stmref)); + error = fz_rethrow(error, "cannot interpret pattern stream (%d %d R)", fz_tonum(stmref), fz_togen(stmref)); goto cleanupcsi; } diff --git a/mupdf/pdf_repair.c b/mupdf/pdf_repair.c index a3d07cda..0baa517e 100644 --- a/mupdf/pdf_repair.c +++ b/mupdf/pdf_repair.c @@ -211,13 +211,13 @@ pdf_repairxref(pdf_xref *xref, char *filename) } if (isroot) { - pdf_logxref("found catalog: %d %d\n", oid, gen); + pdf_logxref("found catalog: (%d %d R)\n", oid, gen); rootoid = oid; rootgen = gen; } if (isinfo) { - pdf_logxref("found info: %d %d\n", oid, gen); + pdf_logxref("found info: (%d %d R)\n", oid, gen); infooid = oid; infogen = gen; } diff --git a/mupdf/pdf_resources.c b/mupdf/pdf_resources.c index 6d24a5e4..ab9ac4bb 100644 --- a/mupdf/pdf_resources.c +++ b/mupdf/pdf_resources.c @@ -57,11 +57,11 @@ preloadcolorspace(pdf_xref *xref, fz_obj *ref) error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve colorspace resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve colorspace resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); error = pdf_loadcolorspace(&colorspace, xref, obj); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load colorspace resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load colorspace resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); pdf_logrsrc("rsrc colorspace %s\n", colorspace->name); @@ -86,7 +86,7 @@ preloadpattern(pdf_xref *xref, fz_obj *ref) error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve pattern/shade resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve pattern/shade resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); type = fz_dictgets(obj, "PatternType"); @@ -95,7 +95,7 @@ preloadpattern(pdf_xref *xref, fz_obj *ref) error = pdf_loadpattern(&pattern, xref, obj, ref); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load pattern resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load pattern resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -104,7 +104,7 @@ preloadpattern(pdf_xref *xref, fz_obj *ref) error = pdf_loadshade(&shade, xref, obj, ref); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load shade resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load shade resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -124,12 +124,12 @@ preloadshading(pdf_xref *xref, fz_obj *ref) fz_obj *obj = ref; error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve shade resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve shade resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); error = pdf_loadshade(&shade, xref, obj, ref); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load shade resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load shade resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -144,7 +144,7 @@ preloadxobject(pdf_xref *xref, fz_obj *ref) error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve xobject/image resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve xobject/image resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); subtype = fz_dictgets(obj, "Subtype"); @@ -153,7 +153,7 @@ preloadxobject(pdf_xref *xref, fz_obj *ref) error = pdf_loadxobject(&xobject, xref, obj, ref); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load xobject resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load xobject resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -162,7 +162,7 @@ preloadxobject(pdf_xref *xref, fz_obj *ref) error = pdf_loadimage(&image, xref, obj, ref); fz_dropobj(obj); if (error) - return fz_rethrow(error, "cannot load image resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load image resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -181,10 +181,10 @@ preloadfont(pdf_xref *xref, fz_obj *ref) fz_obj *obj = ref; error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve font resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve font resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); error = pdf_loadfont(&font, xref, obj, ref); if (error) - return fz_rethrow(error, "cannot load font resource %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load font resource (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -196,7 +196,7 @@ preloadmask(pdf_xref *xref, fz_obj *ref) fz_obj *grp; error = pdf_resolve(&obj, xref); if (error) - return fz_rethrow(error, "cannot resolve mask dictionary %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot resolve mask dictionary (%d %d R)", fz_tonum(ref), fz_togen(ref)); if (fz_isdict(obj)) { diff --git a/mupdf/pdf_save.c b/mupdf/pdf_save.c index 75c02e11..94f407b1 100644 --- a/mupdf/pdf_save.c +++ b/mupdf/pdf_save.c @@ -119,7 +119,7 @@ pdf_updatexref(pdf_xref *xref, char *path) { fz_error *error; fz_stream *out; - int oid; + int oid, gid; int i, n; int startxref; fz_obj *obj; @@ -134,14 +134,15 @@ pdf_updatexref(pdf_xref *xref, char *path) for (oid = 0; oid < xref->len; oid++) { + gid = xref->table[oid].gen; if (xref->table[oid].type == 'a') { xref->table[oid].ofs = fz_tell(out); - error = writeobject(out, xref, xref->crypt, oid, xref->table[oid].gen); + error = writeobject(out, xref, xref->crypt, oid, gid); if (error) { fz_dropstream(out); - return fz_rethrow(error, "cannot write object (oid=%d)", oid); + return fz_rethrow(error, "cannot write object (%d %d R)", oid, gid); } } } @@ -223,7 +224,7 @@ pdf_savexref(pdf_xref *xref, char *path, pdf_crypt *encrypt) { fz_error *error; fz_stream *out; - int oid; + int oid, gid; int startxref; int *ofsbuf; fz_obj *obj; @@ -267,12 +268,13 @@ pdf_savexref(pdf_xref *xref, char *path, pdf_crypt *encrypt) if (x->type == 'n' || x->type == 'o' || x->type == 'a') { ofsbuf[oid] = fz_tell(out); - error = writeobject(out, xref, encrypt, oid, x->type == 'o' ? 0 : x->gen); + gid = x->type == 'o' ? 0 : x->gen; + error = writeobject(out, xref, encrypt, oid, gid); if (error) { if (ofsbuf) fz_free(ofsbuf); fz_dropstream(out); - return fz_rethrow(error, "cannot write object (oid=%d)", oid); + return fz_rethrow(error, "cannot write object (%d %d R)", oid, gid); } } else diff --git a/mupdf/pdf_shade.c b/mupdf/pdf_shade.c index 2bd1d99c..72a174af 100644 --- a/mupdf/pdf_shade.c +++ b/mupdf/pdf_shade.c @@ -153,7 +153,7 @@ loadshadedict(fz_shade **shadep, pdf_xref *xref, fz_obj *dict, fz_obj *ref, fz_m int type; int i; - pdf_logshade("load shade dict %d %d {\n", fz_tonum(ref), fz_togen(ref)); + pdf_logshade("load shade dict (%d %d R) {\n", fz_tonum(ref), fz_togen(ref)); shade = fz_malloc(sizeof(fz_shade)); if (!shade) @@ -272,7 +272,7 @@ pdf_loadshade(fz_shade **shadep, pdf_xref *xref, fz_obj *dict, fz_obj *ref) */ if (fz_dictgets(dict, "PatternType")) { - pdf_logshade("load shade pattern %d %d {\n", fz_tonum(ref), fz_togen(ref)); + pdf_logshade("load shade pattern (%d %d R) {\n", fz_tonum(ref), fz_togen(ref)); obj = fz_dictgets(dict, "Matrix"); if (obj) diff --git a/mupdf/pdf_store.c b/mupdf/pdf_store.c index 99e21017..96dae9b2 100644 --- a/mupdf/pdf_store.c +++ b/mupdf/pdf_store.c @@ -109,7 +109,7 @@ pdf_storeitem(pdf_store *store, pdf_itemkind kind, fz_obj *key, void *val) { struct refkey item; - pdf_logrsrc("store item %d: %d %d R = %p\n", kind, fz_tonum(key), fz_togen(key), val); + pdf_logrsrc("store item %d (%d %d R) ptr=%p\n", kind, fz_tonum(key), fz_togen(key), val); item.kind = kind; item.oid = fz_tonum(key); diff --git a/mupdf/pdf_stream.c b/mupdf/pdf_stream.c index c024dd8b..3bd6df76 100644 --- a/mupdf/pdf_stream.c +++ b/mupdf/pdf_stream.c @@ -362,13 +362,13 @@ pdf_openrawstream(fz_stream **stmp, pdf_xref *xref, int oid, int gen) fz_filter *filter; if (oid < 0 || oid >= xref->len) - return fz_throw("object id out of range (%d)", oid); + return fz_throw("object id out of range (%d %d R)", oid, gen); x = xref->table + oid; error = pdf_cacheobject(xref, oid, gen); if (error) - return fz_rethrow(error, "cannot load stream object (%d)", oid); + return fz_rethrow(error, "cannot load stream object (%d %d R)", oid, gen); if (x->stmbuf) { @@ -418,13 +418,13 @@ pdf_openstream(fz_stream **stmp, pdf_xref *xref, int oid, int gen) fz_filter *filter; if (oid < 0 || oid >= xref->len) - return fz_throw("object id out of range (%d)", oid); + return fz_throw("object id out of range (%d %d R)", oid, gen); x = xref->table + oid; error = pdf_cacheobject(xref, oid, gen); if (error) - return fz_rethrow(error, "cannot load stream object (%d)", oid); + return fz_rethrow(error, "cannot load stream object (%d %d R)", oid, gen); if (x->stmbuf) { @@ -482,12 +482,12 @@ pdf_loadrawstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen) error = pdf_openrawstream(&stm, xref, oid, gen); if (error) - return fz_rethrow(error, "cannot open raw stream (%d)", oid); + return fz_rethrow(error, "cannot open raw stream (%d %d R)", oid, gen); error = fz_readall(bufp, stm, 0); fz_dropstream(stm); if (error) - return fz_rethrow(error, "cannot load stream into buffer (%d)", oid); + return fz_rethrow(error, "cannot load stream into buffer (%d %d R)", oid, gen); return fz_okay; } @@ -502,12 +502,12 @@ pdf_loadstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen) error = pdf_openstream(&stm, xref, oid, gen); if (error) - return fz_rethrow(error, "cannot open stream (%d)", oid); + return fz_rethrow(error, "cannot open stream (%d %d R)", oid, gen); error = fz_readall(bufp, stm, 0); fz_dropstream(stm); if (error) - return fz_rethrow(error, "cannot load stream into buffer (%d)", oid); + return fz_rethrow(error, "cannot load stream into buffer (%d %d R)", oid, gen); return fz_okay; } diff --git a/mupdf/pdf_type3.c b/mupdf/pdf_type3.c index 791b7022..7948a9a5 100644 --- a/mupdf/pdf_type3.c +++ b/mupdf/pdf_type3.c @@ -123,7 +123,7 @@ pdf_loadtype3font(pdf_font **fontp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) if (!font) return fz_throw("outofmem: font struct"); - pdf_logfont("load type3 font %d %d (%p) {\n", fz_tonum(ref), fz_togen(ref), font); + pdf_logfont("load type3 font (%d %d R) ptr=%p {\n", fz_tonum(ref), fz_togen(ref), font); pdf_logfont("name %s\n", buf); font->super.render = t3render; diff --git a/mupdf/pdf_xobject.c b/mupdf/pdf_xobject.c index 2ec6819f..b4678c91 100644 --- a/mupdf/pdf_xobject.c +++ b/mupdf/pdf_xobject.c @@ -31,7 +31,7 @@ pdf_loadxobject(pdf_xobject **formp, pdf_xref *xref, fz_obj *dict, fz_obj *ref) return fz_rethrow(error, "cannot store xobject resource"); } - pdf_logrsrc("load xobject %d %d (%p) {\n", fz_tonum(ref), fz_togen(ref), form); + pdf_logrsrc("load xobject (%d %d R) ptr=%p {\n", fz_tonum(ref), fz_togen(ref), form); obj = fz_dictgets(dict, "BBox"); form->bbox = pdf_torect(obj); diff --git a/mupdf/pdf_xref.c b/mupdf/pdf_xref.c index 20c68583..a2ad01ca 100644 --- a/mupdf/pdf_xref.c +++ b/mupdf/pdf_xref.c @@ -295,7 +295,7 @@ pdf_deleteobject(pdf_xref *xref, int oid, int gen) int prev; if (oid < 0 || oid >= xref->len) - return fz_throw("assert: object out of range: %d", oid); + return fz_throw("assert: object out of range (%d %d R)", oid, gen); pdf_logxref("deleteobj %d %d\n", oid, gen); @@ -326,7 +326,7 @@ pdf_updateobject(pdf_xref *xref, int oid, int gen, fz_obj *obj) pdf_xrefentry *x; if (oid < 0 || oid >= xref->len) - return fz_throw("assert: object out of range: %d", oid); + return fz_throw("assert: object out of range (%d %d R)", oid, gen); pdf_logxref("updateobj %d %d (%p)\n", oid, gen, obj); @@ -355,7 +355,7 @@ pdf_updatestream(pdf_xref *xref, int oid, int gen, fz_buffer *stm) pdf_xrefentry *x; if (oid < 0 || oid >= xref->len) - return fz_throw("assert: object out of range: %d", oid); + return fz_throw("assert: object out of range (%d %d R)", oid, gen); pdf_logxref("updatestm %d %d (%p)\n", oid, gen, stm); @@ -382,7 +382,7 @@ pdf_cacheobject(pdf_xref *xref, int oid, int gen) int roid, rgen; if (oid < 0 || oid >= xref->len) - return fz_throw("object out of range: %d", oid); + return fz_throw("object out of range (%d %d R)", oid, gen); x = &xref->table[oid]; @@ -401,14 +401,14 @@ pdf_cacheobject(pdf_xref *xref, int oid, int gen) { error = fz_seek(xref->file, x->ofs, 0); if (error) - return fz_rethrow(error, "cannot seek to object %d (ofs=%d)", oid, x->ofs); + return fz_rethrow(error, "cannot seek to object (%d %d R) offset %d", oid, gen, x->ofs); error = pdf_parseindobj(&x->obj, xref->file, buf, sizeof buf, &roid, &rgen, &x->stmofs); if (error) - return fz_rethrow(error, "cannot parse object %d", oid);; + return fz_rethrow(error, "cannot parse object (%d %d R)", oid, gen); if (roid != oid || rgen != gen) - return fz_throw("found object %d %d instead of %d %d", roid, rgen, oid, gen); + return fz_throw("found object (%d %d R) instead of (%d %d R)", roid, rgen, oid, gen); if (xref->crypt) pdf_cryptobj(xref->crypt, x->obj, oid, gen); @@ -420,7 +420,7 @@ pdf_cacheobject(pdf_xref *xref, int oid, int gen) { error = pdf_loadobjstm(xref, x->ofs, 0, buf, sizeof buf); if (error) - return fz_rethrow(error, "cannot load object stream containing object %d", oid); + return fz_rethrow(error, "cannot load object stream containing object (%d %d R)", oid, gen); } } @@ -434,7 +434,7 @@ pdf_loadobject(fz_obj **objp, pdf_xref *xref, int oid, int gen) error = pdf_cacheobject(xref, oid, gen); if (error) - return fz_rethrow(error, "cannot load object %d into cache", oid); + return fz_rethrow(error, "cannot load object (%d %d R) into cache", oid, gen); *objp = fz_keepobj(xref->table[oid].obj); @@ -451,7 +451,7 @@ pdf_loadindirect(fz_obj **objp, pdf_xref *xref, fz_obj *ref) error = pdf_loadobject(objp, xref, fz_tonum(ref), fz_togen(ref)); if (error) - return fz_rethrow(error, "cannot load indirect object %d", fz_tonum(ref)); + return fz_rethrow(error, "cannot load indirect object (%d %d R)", fz_tonum(ref), fz_togen(ref)); return fz_okay; } @@ -465,7 +465,7 @@ pdf_resolve(fz_obj **objp, pdf_xref *xref) { error = pdf_loadindirect(objp, xref, *objp); if (error) - return fz_rethrow(error, "cannot load indirect object %d", fz_tonum(*objp)); + return fz_rethrow(error, "cannot load indirect object (%d %d R)", fz_tonum(*objp), fz_togen(*objp)); return fz_okay; } |