[poppler] poppler/Catalog.cc poppler/Dict.cc poppler/Dict.h

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Nov 23 12:32:01 PST 2010


 poppler/Catalog.cc |    2 +-
 poppler/Dict.cc    |    4 ++++
 poppler/Dict.h     |    2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 52e25cca7e75a8b8eac95a3cec258f1cd9f8ecaa
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Nov 23 20:31:14 2010 +0000

    If it is not a Page but has no Kids either let's just pretend it's a page
    
    Fixes broken PDF at bug 31861

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 6b28997..664d18a 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -333,7 +333,7 @@ GBool Catalog::cachePageTree(int page)
     Object kid;
     kids.arrayGet(kidsIdx, &kid);
     kids.free();
-    if (kid.isDict("Page")) {
+    if (kid.isDict("Page") || (kid.isDict() && !kid.getDict()->hasKey("Kids"))) {
       PageAttrs *attrs = new PageAttrs(attrsList->back(), kid.getDict());
       Page *p = new Page(xref, lastCachedPage+1, kid.getDict(),
                      kidRef.getRef(), attrs, form);
diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 2318e69..1428113 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -141,6 +141,10 @@ inline DictEntry *Dict::find(char *key) {
   return NULL;
 }
 
+GBool Dict::hasKey(char *key) {
+  return find(key) != NULL;
+}
+
 void Dict::remove(char *key) {
   if (sorted) {
     const int pos = binarySearch(key, entries, length);
diff --git a/poppler/Dict.h b/poppler/Dict.h
index 95c596c..f4ed64a 100644
--- a/poppler/Dict.h
+++ b/poppler/Dict.h
@@ -87,6 +87,8 @@ public:
   void setXRef(XRef *xrefA) { xref = xrefA; }
   
   XRef *getXRef() { return xref; }
+  
+  GBool hasKey(char *key);
 
 private:
 


More information about the poppler mailing list