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

Function f_flate

internal/cbm/pdf/pdf_obj.c:2217–2242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2215}
2216
2217static bool f_flate(pdf_doc_t *d, const unsigned char *in, size_t n, pdf_buf_t *out) {
2218 bool ended;
2219 bool errored;
2220 inflate_run(in, n, PDF_ZLIB_WBITS, false, out, &ended, &errored);
2221 if (out->fail) {
2222 return false;
2223 }
2224 if (ended || out->n > PDF_MAX_STREAM_OUT) {
2225 return true;
2226 }
2227 d->counts->flate_recovered++;
2228 for (int k = 0; k < 2; k++) {
2229 out->n = 0;
2230 const unsigned char *src = k ? in + (n >= 2 ? 2 : n) : in;
2231 size_t sn = k ? (n >= 2 ? n - 2 : 0) : n;
2232 inflate_run(src, sn, k ? -PDF_ZLIB_WBITS : PDF_ZLIB_WBITS, true, out, &ended, &errored);
2233 if (out->fail) {
2234 return false;
2235 }
2236 if (out->n) {
2237 return true;
2238 }
2239 }
2240 out->n = 0;
2241 return true;
2242}
2243
2244/* PNG (>= 10) and TIFF (2) predictors. false: parameters it cannot apply. */
2245static bool f_predict(pdf_doc_t *d, pdf_val_t *parms, pdf_buf_t *io) {

Callers 1

decode_filtersFunction · 0.85

Calls 1

inflate_runFunction · 0.85

Tested by

no test coverage detected