MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / pdf_doc_open

Function pdf_doc_open

internal/cbm/pdf/pdf_obj.c:2126–2138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2124}
2125
2126bool pdf_doc_open(pdf_doc_t *d) {
2127 const unsigned char *h = cbm_memmem(d->data, d->len, "%PDF-", 5);
2128 d->hdr = h ? (size_t)(h - d->data) : 0;
2129 bool ok = load_xref(d);
2130 if (ok) {
2131 pdf_val_t *root = pdf_resolve(d, pdf_dget_raw(d->trailer, "Root"));
2132 ok = root && root->kind == PV_DICT;
2133 }
2134 if (!ok && !d->nomem) {
2135 reconstruct(d);
2136 }
2137 return !d->nomem;
2138}
2139
2140void pdf_doc_close(pdf_doc_t *d) {
2141 if (d->scratch_arena_live) {

Callers 1

cbm_pdf_extractFunction · 0.85

Calls 5

cbm_memmemFunction · 0.85
load_xrefFunction · 0.85
pdf_resolveFunction · 0.85
pdf_dget_rawFunction · 0.85
reconstructFunction · 0.85

Tested by

no test coverage detected