From 098b98c889400aa33c81d71123418eecc4be2162 Mon Sep 17 00:00:00 2001 From: m-holger Date: Tue, 4 Jul 2023 17:07:44 +0100 Subject: [PATCH] Tidy QPDF::read_xrefTable(qpdf_offset_t xref_offset) --- libqpdf/QPDF.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 53634485..9554027c 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -910,7 +910,6 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset) qpdf_offset_t QPDF::read_xrefStream(qpdf_offset_t xref_offset) { - bool found = false; if (!m->ignore_xref_streams) { QPDFObjGen x_og; QPDFObjectHandle xref_obj; @@ -922,17 +921,13 @@ QPDF::read_xrefStream(qpdf_offset_t xref_offset) } if (xref_obj.isStreamOfType("/XRef")) { QTC::TC("qpdf", "QPDF found xref stream"); - found = true; - xref_offset = processXRefStream(xref_offset, xref_obj); + return processXRefStream(xref_offset, xref_obj); } } - if (!found) { - QTC::TC("qpdf", "QPDF can't find xref"); - throw damagedPDF("", xref_offset, "xref not found"); - } - - return xref_offset; + QTC::TC("qpdf", "QPDF can't find xref"); + throw damagedPDF("", xref_offset, "xref not found"); + return 0; // unreachable } qpdf_offset_t