From 97f737a562dcf7f50cec2060c9cc5a9dce06f58f Mon Sep 17 00:00:00 2001 From: m-holger Date: Thu, 23 Jun 2022 10:32:32 +0100 Subject: Code tidy: QPDFJob::doJSONPageLabels Remove redundant variables pages and next. --- libqpdf/QPDFJob.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 5631df49..7227bd1b 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -1239,16 +1239,13 @@ QPDFJob::doJSONPageLabels(Pipeline* p, bool& first, QPDF& pdf) { JSON j_labels = JSON::makeArray(); QPDFPageLabelDocumentHelper pldh(pdf); - QPDFPageDocumentHelper pdh(pdf); - std::vector pages = pdh.getAllPages(); + long long npages = QIntC::to_longlong( + QPDFPageDocumentHelper(pdf).getAllPages().size()); if (pldh.hasPageLabels()) { std::vector labels; - pldh.getLabelsForPageRange( - 0, QIntC::to_int(pages.size()) - 1, 0, labels); + pldh.getLabelsForPageRange(0, npages - 1, 0, labels); for (auto iter = labels.begin(); iter != labels.end(); ++iter) { - auto next = iter; - ++next; - if (next == labels.end()) { + if ((iter + 1) == labels.end()) { // This can't happen, so ignore it. This could only // happen if getLabelsForPageRange somehow returned an // odd number of items. -- cgit v1.2.3-54-g00ecf