[poppler] 2 commits - poppler/XRef.cc poppler/XRef.h

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Apr 17 11:41:10 PDT 2012


 poppler/XRef.cc |   12 +++++++-----
 poppler/XRef.h  |    2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 7fbeaac5c0d0240564add6c252c1ba7c14639d98
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Apr 17 20:36:51 2012 +0200

    Be sure we are checking a non free entry

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index feb7960..e025107 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1146,7 +1146,7 @@ int XRef::getNumEntry(Guint offset)
     for (int i = 1; i < size; ++i)
     {
       e = getEntry(i, gFalse);
-      if (e->offset < offset && e->offset >= resOffset)
+      if (e->type != xrefEntryFree && e->offset < offset && e->offset >= resOffset)
       {
         res = i;
         resOffset = e->offset;
commit d1254c7e8e995302542093968a0c2967f3c0b5ff
Author: Thomas Freitag <Thomas.Freitag at kabelmail.de>
Date:   Tue Apr 17 20:36:03 2012 +0200

    Do not complain if the entry does not exist
    
    XRef::getNumEntry is only trying to find which entry a given stream pos belongs so no need to cry if the entry is not there
    Bug 48679

diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 80ce17f..feb7960 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1145,7 +1145,7 @@ int XRef::getNumEntry(Guint offset)
     XRefEntry *e;
     for (int i = 1; i < size; ++i)
     {
-      e = getEntry(i);
+      e = getEntry(i, gFalse);
       if (e->offset < offset && e->offset >= resOffset)
       {
         res = i;
@@ -1314,7 +1314,7 @@ GBool XRef::parseEntry(Guint offset, XRefEntry *entry)
   return r;
 }
 
-XRefEntry *XRef::getEntry(int i)
+XRefEntry *XRef::getEntry(int i, GBool complainIfMissing)
 {
   if (entries[i].type == xrefEntryNone) {
 
@@ -1371,8 +1371,10 @@ XRefEntry *XRef::getEntry(int i)
       }
 
       if (entries[i].type == xrefEntryNone) {
-         error(errSyntaxError, -1, "Invalid XRef entry");
-         entries[i].type = xrefEntryFree;
+        if (complainIfMissing) {
+          error(errSyntaxError, -1, "Invalid XRef entry");
+        }
+        entries[i].type = xrefEntryFree;
       }
     }
   }
diff --git a/poppler/XRef.h b/poppler/XRef.h
index ea2c1b4..4cba474 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -127,7 +127,7 @@ public:
   int getNumEntry(Guint offset);
 
   // Direct access.
-  XRefEntry *getEntry(int i);
+  XRefEntry *getEntry(int i, GBool complainIfMissing = gTrue);
   Object *getTrailerDict() { return &trailerDict; }
 
   // Write access


More information about the poppler mailing list