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

Function member_end

internal/cbm/pdf/pdf_obj.c:1377–1402  ·  view source on GitHub ↗

Where the member after the one at `at` starts (sm->len when none): members * do not overlap, as the objects of a file do not (object_end). */

Source from the content-addressed store, hash-verified

1375/* Where the member after the one at `at` starts (sm->len when none): members
1376 * do not overlap, as the objects of a file do not (object_end). */
1377static size_t member_end(pdf_doc_t *d, pdf_objstm_t *sm, size_t at) {
1378 if (!sm->starts) {
1379 sm->starts = (int64_t *)pdf_big(d, (size_t)(sm->n ? sm->n : 1) * sizeof(int64_t));
1380 if (!sm->starts) {
1381 return sm->len;
1382 }
1383 for (int i = 0; i < sm->n; i++) {
1384 sm->starts[i] = pdf_sat_add(sm->first, sm->ooff[i]);
1385 }
1386 qsort(sm->starts, (size_t)sm->n, sizeof(int64_t), i64_cmp);
1387 }
1388 int lo = 0;
1389 int hi = sm->n;
1390 while (lo < hi) {
1391 int mid = lo + (hi - lo) / 2;
1392 if (sm->starts[mid] > (int64_t)at) {
1393 hi = mid;
1394 } else {
1395 lo = mid + 1;
1396 }
1397 }
1398 if (lo < sm->n && (uint64_t)sm->starts[lo] < (uint64_t)sm->len) {
1399 return (size_t)sm->starts[lo];
1400 }
1401 return sm->len;
1402}
1403
1404static int64_t objstm_find(pdf_doc_t *d, pdf_objstm_t *sm, int64_t num, int64_t idx) {
1405 if (idx >= 0 && idx < sm->n && sm->onum[idx] == num) {

Callers 1

pdf_getFunction · 0.85

Calls 2

pdf_bigFunction · 0.85
pdf_sat_addFunction · 0.85

Tested by

no test coverage detected