From fcc840b63163d93a024e6e90a74a02cf5edfefbf Mon Sep 17 00:00:00 2001 From: Simon Kellner Date: Fri, 21 Jan 2011 15:07:45 +0100 Subject: [PATCH] fix labelToIndex on multiple prefixes A PDF document can use page label prefixes, for example, to label only inside a chapter ("A-1" .. "A-", "B-1" .. "B-" et cetera). When calculating a page index for a given label, poppler would disregard the page range for all preceding prefixes that do not match the given prefix. --- poppler/PageLabelInfo.cc | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-) diff --git a/poppler/PageLabelInfo.cc b/poppler/PageLabelInfo.cc index 84cb50f..588c607 100644 --- a/poppler/PageLabelInfo.cc +++ b/poppler/PageLabelInfo.cc @@ -260,8 +260,7 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) int prefixLength; int i, base, number; - base = 0; - for (i = 0; i < intervals.getLength(); i++) { + for (base = 0, i = 0; i < intervals.getLength(); i++, base += interval->length) { interval = (Interval *) intervals.get(i); prefixLength = interval->prefix->getLength(); if (label->cmpN(interval->prefix, prefixLength) != 0) @@ -294,8 +293,6 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) case Interval::None: break; } - - base += interval->length; } return gFalse; -- 1.7.3.5