[poppler] poppler/poppler: XRef.cc,1.12,1.13

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Apr 1 03:25:59 PST 2006


Update of /cvs/poppler/poppler/poppler
In directory kemper:/tmp/cvs-serv27970/poppler

Modified Files:
	XRef.cc 
Log Message:
Fix bug 6454


Index: XRef.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/XRef.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- XRef.cc	18 Jan 2006 22:32:13 -0000	1.12
+++ XRef.cc	1 Apr 2006 11:25:57 -0000	1.13
@@ -937,19 +937,23 @@
 
 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) {



More information about the poppler mailing list