ref: 02fc81c3d68b45a6901de9032e61cb91f33b033c
dir: /eval.c/
#include <u.h> #include <libc.h> #include <bio.h> #include "pdf.h" Object * pdfeval(Object **oo) { Object *d, *o; Xref *x; int i; if(oo == nil) return &null; if(*oo == nil){ *oo = &null; return &null; } o = *oo; if(o->type != Oindir) return o; for(i = 0; i < o->pdf->nxref && o->pdf->xref[i].id != o->indir.id; i++); if(i >= o->pdf->nxref){ werrstr("no object id %d in xref", o->indir.id); return &null; } x = &o->pdf->xref[i]; if(Bseek(o->pdf->bio, x->off, 0) != x->off){ werrstr("xref seek failed"); return &null; } if((d = pdfobj(o->pdf, o->pdf->bio)) == nil) return &null; *oo = d; pdfobjfree(o); return d; }