Where the first object header at or after `at` starts (d->len when none): * an object's value is read up to there. The objects of a file do not overlap; * a token that ran on into the next ones (a string without its end) made every * object before it read the rest of the file again, n objects times the file. * The bytes of a stream are not bounded by this: its /Length places them. */
| 1080 | * object before it read the rest of the file again, n objects times the file. |
| 1081 | * The bytes of a stream are not bounded by this: its /Length places them. */ |
| 1082 | static size_t object_end(pdf_doc_t *d, size_t at) { |
| 1083 | if (!build_hdrs(d)) { |
| 1084 | return d->len; |
| 1085 | } |
| 1086 | int lo = 0; |
| 1087 | int hi = d->nhdrs; |
| 1088 | while (lo < hi) { |
| 1089 | int mid = lo + (hi - lo) / 2; |
| 1090 | if (d->hdrs[mid].off >= at) { |
| 1091 | hi = mid; |
| 1092 | } else { |
| 1093 | lo = mid + 1; |
| 1094 | } |
| 1095 | } |
| 1096 | return lo < d->nhdrs ? d->hdrs[lo].off : d->len; |
| 1097 | } |
| 1098 | |
| 1099 | /* The value of the object at off (or off + hdr), without its stream; *stream_at |
| 1100 | * is where a "stream" keyword after the value starts, 0 when none follows. NULL: |
no test coverage detected