Branch Coverage

src/pdfmake_import.c
Criterion Covered Total %
branch 52 116 44.8


line true false branch
36 24 0 if (!src_reader || !dst) return NULL;
0 24 if (!src_reader || !dst) return NULL;
37 0 24 if (!src_reader->parser) return NULL;
40 0 24 if (!ctx) return NULL;
50 0 24 if (!ctx->remap) {
59 0 24 if (!ctx) return;
84 259 0 if (src_num == 0 || src_num >= ctx->remap_size) return 0;
0 259 if (src_num == 0 || src_num >= ctx->remap_size) return 0;
85 100 159 if (ctx->remap[src_num] != 0) return ctx->remap[src_num];
90 0 159 if (!src_obj) return 0;
94 0 159 if (dst_num == 0) return 0;
101 51 108 if (src_obj->kind == PDFMAKE_STREAM) {
121 0 437 if (!bytes) return pdfmake_null();
133 0 0 if (!copy && src.as.str.len > 0) return pdfmake_null();
0 0 if (!copy && src.as.str.len > 0) return pdfmake_null();
147 80 0 if (out.kind != PDFMAKE_ARRAY || !src.as.arr) return out;
0 80 if (out.kind != PDFMAKE_ARRAY || !src.as.arr) return out;
148 1613 80 for (i = 0; i < src.as.arr->len; i++) {
150 0 1613 if (!pdfmake_array_push(ctx->dst_arena, &out, elem)) break;
164 0 292 if (out.kind != PDFMAKE_DICT) return out;
167 1060 292 while (pdfmake_dict_iter_next(&it)) {
170 0 1060 if (!kb) continue;
172 0 1060 if (new_key == 0) continue;
191 0 0 if (out.kind != PDFMAKE_STREAM || !src.as.stream) return out;
0 0 if (out.kind != PDFMAKE_STREAM || !src.as.stream) return out;
198 0 0 if (src.as.stream->raw && src.as.stream->raw_len > 0) {
0 0 if (src.as.stream->raw && src.as.stream->raw_len > 0) {
236 51 0 if (!ctx->src_reader ||
237 51 0 !ctx->src_reader->crypt ||
238 0 51 !ctx->src_reader->authenticated) {
250 0 51 if (err != PDFMAKE_OK) {
260 0 51 if (out.kind != PDFMAKE_STREAM) {
282 51 0 if (decoded.len > 0) {
306 0 259 if (dst_num == 0) return pdfmake_null();
314 0 0 if (!ctx) return 0;
325 0 88 if (!obj) return NULL;
326 18 70 if (obj->kind == PDFMAKE_REF) {
348 44 0 while (current && current->kind == PDFMAKE_DICT && depth < 32) {
44 0 while (current && current->kind == PDFMAKE_DICT && depth < 32) {
44 0 while (current && current->kind == PDFMAKE_DICT && depth < 32) {
351 44 0 if (res && res->kind == PDFMAKE_DICT) return res;
44 0 if (res && res->kind == PDFMAKE_DICT) return res;
354 0 0 if (!parent) break;
373 0 44 if (!ctx) return NULL;
376 0 44 if (!rp) return NULL;
379 0 44 if (pdfmake_reader_page_media_box(ctx->src_reader, rp, mbox) != PDFMAKE_OK) {
384 44 0 if (width <= 0 || height <= 0) return NULL;
0 44 if (width <= 0 || height <= 0) return NULL;
388 0 44 if (!dst_page) return NULL;
394 44 0 if (pdfmake_buf_init(&content) == PDFMAKE_OK) {
397 44 0 if (cerr == PDFMAKE_OK && content.len > 0) {
44 0 if (cerr == PDFMAKE_OK && content.len > 0) {
409 44 0 if (resources && resources->kind == PDFMAKE_DICT) {
44 0 if (resources && resources->kind == PDFMAKE_DICT) {
411 44 0 if (dst_res.kind == PDFMAKE_DICT) {
425 0 0 if (!ctx) return 0;
428 0 0 for (i = 0; i < total; i++) {
429 0 0 if (!pdfmake_doc_import_page(ctx, i)) break;