An object a stream's /Length names, read as a value only and cached as * pdf_get caches it. An object that is a stream there gives no length and is * marked: loading it would read ITS /Length first, one nested call per stream * of a chain of such streams. */
| 1146 | * marked: loading it would read ITS /Length first, one nested call per stream |
| 1147 | * of a chain of such streams. */ |
| 1148 | static pdf_val_t *length_object(pdf_doc_t *d, int64_t num) { |
| 1149 | pdf_xent_t *e = xent(d, num); |
| 1150 | bool ok; |
| 1151 | size_t stream_at; |
| 1152 | pdf_val_t *v = indirect_value_at(d, e->a, true, num, &ok, &stream_at); |
| 1153 | if (!ok && !d->reconstructed) { |
| 1154 | int64_t off = hdr_first_exact(d, num, e->b); |
| 1155 | if (off >= 0) { |
| 1156 | v = indirect_value_at(d, off, true, num, &ok, &stream_at); |
| 1157 | } |
| 1158 | } |
| 1159 | e = xent(d, num); |
| 1160 | if (ok && stream_at) { |
| 1161 | e->not_length = true; |
| 1162 | return NULL; |
| 1163 | } |
| 1164 | e->cached = true; |
| 1165 | e->obj = ok ? v : NULL; |
| 1166 | return e->obj; |
| 1167 | } |
| 1168 | |
| 1169 | /* A stream's /Length through its references (at most PDF_MAX_RESOLVE, as |
| 1170 | * pdf_resolve). */ |
no test coverage detected