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

Function pdf_stream_decode

internal/cbm/pdf/pdf_obj.c:2741–2771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2739}
2740
2741const unsigned char *pdf_stream_decode(pdf_doc_t *d, pdf_stream_t *st, size_t *len) {
2742 if (st->done) {
2743 *len = st->dec_len;
2744 return st->decoded;
2745 }
2746 st->done = true;
2747 st->decoded = NULL;
2748 st->dec_len = 0;
2749 *len = 0;
2750 pdf_buf_t held = {0};
2751 size_t cur_len;
2752 const unsigned char *cur = decode_filters(d, st, &cur_len, &held);
2753 if (!cur) {
2754 return NULL;
2755 }
2756 if (held.p) {
2757 unsigned char *fit =
2758 (unsigned char *)cbm_realloc(CBM_MEM_CLASS_EXTRACT, held.p, held.n ? held.n : 1);
2759 if (fit) {
2760 held.p = fit;
2761 }
2762 if (!pdf_own(d, held.p)) {
2763 return NULL;
2764 }
2765 cur = held.p;
2766 }
2767 st->decoded = cur;
2768 st->dec_len = cur_len;
2769 *len = cur_len;
2770 return cur;
2771}

Callers 7

type1_builtinFunction · 0.85
font_init_type0Function · 0.85
font_newFunction · 0.85
font_revFunction · 0.85
do_xobjectFunction · 0.85
page_extractFunction · 0.85
objstm_openFunction · 0.85

Calls 3

decode_filtersFunction · 0.85
cbm_reallocFunction · 0.85
pdf_ownFunction · 0.85

Tested by

no test coverage detected