diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-07-27 16:41:49 +0000 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-07-27 16:41:49 +0000 |
commit | e5d46b949009a1759fdf252ffc9dfd3f49d5fec0 (patch) | |
tree | 56378d4ba4ca3e8bc35748d0553c5d17506d18f0 /fitz | |
parent | 37211633cf44cc8fead75933e9f594a030998a33 (diff) | |
download | mupdf-e5d46b949009a1759fdf252ffc9dfd3f49d5fec0.tar.xz |
Don't cache resolved objects in the indirect reference object (rely on the xref cache instead).
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/fitz.h | 1 | ||||
-rw-r--r-- | fitz/obj_simple.c | 30 |
2 files changed, 9 insertions, 22 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index 150c3e56..89a1cc63 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -371,7 +371,6 @@ struct fz_obj_s int num; int gen; struct pdf_xref_s *xref; - fz_obj *obj; } r; } u; }; diff --git a/fitz/obj_simple.c b/fitz/obj_simple.c index fdd18ce1..f279bd55 100644 --- a/fitz/obj_simple.c +++ b/fitz/obj_simple.c @@ -74,7 +74,6 @@ fz_newindirect(int num, int gen, pdf_xref *xref) o->u.r.num = num; o->u.r.gen = gen; o->u.r.xref = xref; - o->u.r.obj = nil; return o; } @@ -93,23 +92,11 @@ fz_dropobj(fz_obj *o) if (--o->refs == 0) { if (o->kind == FZ_ARRAY) - { fz_freearray(o); - } else if (o->kind == FZ_DICT) - { fz_freedict(o); - } - else if (o->kind == FZ_INDIRECT) - { - if (o->u.r.obj) - fz_dropobj(o->u.r.obj); - fz_free(o); - } else - { fz_free(o); - } } } @@ -234,22 +221,23 @@ int fz_togen(fz_obj *obj) fz_obj *fz_resolveindirect(fz_obj *ref) { - int error; - if (fz_isindirect(ref)) { - if (!ref->u.r.obj && ref->u.r.xref) + pdf_xref *xref = ref->u.r.xref; + int num = fz_tonum(ref); + int gen = fz_togen(ref); + if (xref) { - error = pdf_loadobject(&ref->u.r.obj, ref->u.r.xref, fz_tonum(ref), fz_togen(ref)); + fz_error error = pdf_cacheobject(xref, num, gen); if (error) { - fz_catch(error, "cannot resolve reference (%d %d R); ignoring error", fz_tonum(ref), fz_togen(ref)); - ref->u.r.obj = fz_keepobj(ref); + fz_catch(error, "cannot load object (%d %d R) into cache", num, gen); + return ref; } + if (xref->table[num].obj) + return xref->table[num].obj; } - return ref->u.r.obj; } - return ref; } |