From 7f97f80d1a74a50d369b3bdf513de7fbcaed6bc3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 8 Aug 2017 13:22:06 +0200 Subject: Remove redundant (and incomplete) checks when encountering OCGs. The checks were duplicated between pdf_process_BDC and pdf_is_hidden_ocg. The checks in the former function were incomplete: they only checked the for OCG type objects and incorrectly discarded OCMD type objects. Remove the checks from pdf_process_BDC and let pdf_is_hidden_ocg handle all of them instead. --- source/pdf/pdf-interpret.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index 051e0a59..acebdf87 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -510,11 +510,8 @@ resolve_properties(fz_context *ctx, pdf_csi *csi, pdf_obj *obj) static void pdf_process_BDC(fz_context *ctx, pdf_processor *proc, pdf_csi *csi) { - pdf_obj *raw = csi->obj; - pdf_obj *cooked = resolve_properties(ctx, csi, raw); - if (proc->op_BDC) - proc->op_BDC(ctx, proc, csi->name, raw, cooked); + proc->op_BDC(ctx, proc, csi->name, csi->obj, resolve_properties(ctx, csi, csi->obj)); /* Already hidden, no need to look further */ if (proc->hidden > 0) @@ -527,15 +524,7 @@ pdf_process_BDC(fz_context *ctx, pdf_processor *proc, pdf_csi *csi) if (strcmp(csi->name, "OC")) return; - /* No Properties array, or name not found, means visible. */ - if (!cooked) - return; - - /* Wrong type of property */ - if (!pdf_name_eq(ctx, pdf_dict_get(ctx, cooked, PDF_NAME_Type), PDF_NAME_OCG)) - return; - - if (pdf_is_hidden_ocg(ctx, csi->doc->ocg, csi->rdb, proc->usage, cooked)) + if (pdf_is_hidden_ocg(ctx, csi->doc->ocg, csi->rdb, proc->usage, csi->obj)) ++proc->hidden; } -- cgit v1.2.3