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

Function match_xref_entry

internal/cbm/pdf/pdf_obj.c:1592–1631  ·  view source on GitHub ↗

"[ws]*(\d{1,10})[ws]+(\d{1,5})[ws]*([nf])" at p. */

Source from the content-addressed store, hash-verified

1590
1591/* "[ws]*(\d{1,10})[ws]+(\d{1,5})[ws]*([nf])" at p. */
1592static bool match_xref_entry(const pdf_doc_t *d, size_t p, int64_t *off, int64_t *gen, char *kind,
1593 size_t *end) {
1594 const unsigned char *s = d->data;
1595 size_t len = d->len;
1596 while (p < len && is_ws(s[p])) {
1597 p++;
1598 }
1599 size_t a = p;
1600 while (p < len && is_digit(s[p])) {
1601 p++;
1602 }
1603 if (p == a || p - a > 10) {
1604 return false;
1605 }
1606 *off = sat_digits(s + a, p - a);
1607 size_t w = p;
1608 while (p < len && is_ws(s[p])) {
1609 p++;
1610 }
1611 if (p == w) {
1612 return false;
1613 }
1614 a = p;
1615 while (p < len && is_digit(s[p])) {
1616 p++;
1617 }
1618 if (p == a || p - a > 5) {
1619 return false;
1620 }
1621 *gen = sat_digits(s + a, p - a);
1622 while (p < len && is_ws(s[p])) {
1623 p++;
1624 }
1625 if (p >= len || (s[p] != 'n' && s[p] != 'f')) {
1626 return false;
1627 }
1628 *kind = (char)s[p];
1629 *end = p + 1;
1630 return true;
1631}
1632
1633static bool xref_table(pdf_doc_t *d, size_t p, pdf_xref_t *sec, pdf_val_t **tr) {
1634 const unsigned char *s = d->data;

Callers 1

xref_tableFunction · 0.85

Calls 3

is_wsFunction · 0.85
is_digitFunction · 0.85
sat_digitsFunction · 0.85

Tested by

no test coverage detected