summaryrefslogtreecommitdiff
path: root/poppler
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 /poppler
parentfe8142fbc12127682b8024673fe1af57b47bb5c9 (diff)
Fix bug 6454
Diffstat (limited to 'poppler')
-rw-r--r--poppler/XRef.cc22
1 files changed, 13 insertions, 9 deletions
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) {