[poppler] poppler/PageLabelInfo.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Jan 26 14:59:01 PST 2011


 poppler/PageLabelInfo.cc |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 4829d36a3b005585db8c8115f7ee81a4e2384780
Author: Simon Kellner <kellner at kit.edu>
Date:   Wed Jan 26 22:59:49 2011 +0000

    fix labelToIndex on multiple prefixes
    
    A PDF document can use page label prefixes, for example, to label
    only inside a chapter ("A-1" .. "A-<n>", "B-1" .. "B-<m>" 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.

diff --git a/poppler/PageLabelInfo.cc b/poppler/PageLabelInfo.cc
index 84cb50f..1330988 100644
--- a/poppler/PageLabelInfo.cc
+++ b/poppler/PageLabelInfo.cc
@@ -4,6 +4,7 @@
 //
 // Copyright (C) 2005-2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005, 2009 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2011 Simon Kellner <kellner at kit.edu>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -258,11 +259,11 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index)
   Interval *interval;
   char *str = label->getCString(), *end;
   int prefixLength;
-  int i, base, number;
+  int i, number;
 
-  base = 0;
   for (i = 0; i < intervals.getLength(); i++) {
     interval = (Interval *) intervals.get(i);
+    const int base = interval->base;
     prefixLength = interval->prefix->getLength();
     if (label->cmpN(interval->prefix, prefixLength) != 0)
       continue;
@@ -294,8 +295,6 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index)
     case Interval::None:
       break;
     }
-
-    base += interval->length;
   }
 
   return gFalse;


More information about the poppler mailing list