summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2006-04-01 11:25:57 +0000
committerAlbert Astals Cid <aacid@kde.org>2006-04-01 11:25:57 +0000
commitc80ebf237e9c6232a1d0567a2688a294acfd481b (patch)
treed420c14699e2a56ff83dd4a3ee461492db95c111
parentfe8142fbc12127682b8024673fe1af57b47bb5c9 (diff)
Fix bug 6454
-rw-r--r--ChangeLog5
-rw-r--r--poppler/XRef.cc22
2 files changed, 18 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 66e384f8..5c57067c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-01 Albert Astals Cid <aacid@kde.org>
+
+ * poppler/XRef.cc: Fix parsing of some TOCs, bug was due a int to uint
+ comparison, sorry for introducing that bug. Fixes bug 6454
+
2006-03-20 Jeff Muizelaar <jeff@infidigm.net>
* glib/poppler-page.cc: Avoid strdup in poppler_page_get_property and
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index e569505b..bbfb2462 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -937,19 +937,23 @@ GBool XRef::getStreamEnd(Guint streamStart, Guint *streamEnd) {
int XRef::getNumEntry(int offset) const
{
- int res = -1;
- int resOffset = -1;
- XRefEntry e;
- for (int i = 0; i < size; ++i)
+ if (size > 0)
{
- e = entries[i];
- if (e.offset < offset && e.offset > resOffset)
+ int res = 0;
+ Guint resOffset = entries[0].offset;
+ XRefEntry e;
+ for (int i = 1; i < size; ++i)
{
- res = i;
- resOffset = e.offset;
+ e = entries[i];
+ if (e.offset < offset && e.offset >= resOffset)
+ {
+ res = i;
+ resOffset = e.offset;
+ }
}
+ return res;
}
- return res;
+ else return -1;
}
Guint XRef::strToUnsigned(char *s) {