[poppler] poppler/Catalog.cc

Pino Toscano pino at kemper.freedesktop.org
Sat Sep 20 16:07:23 PDT 2008


 poppler/Catalog.cc |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit b56f64d676bdabd4a3ebe0eb2237f4c202a3707d
Author: Pino Toscano <pino at kde.org>
Date:   Sun Sep 21 00:53:54 2008 +0200

    Handle streams as entries for the catalog JS name tree.

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index aef2a15..570dfb1 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -446,12 +446,20 @@ GooString *Catalog::getJS(int i)
     obj.free();
     return 0;
   }
-  if (!obj.dictLookup("JS", &obj2)->isString()) {
-    obj2.free();
-    obj.free();
-    return 0;
+  obj.dictLookup("JS", &obj2);
+  GooString *js = 0;
+  if (obj2.isString()) {
+    js = new GooString(obj2.getString());
+  }
+  else if (obj2.isStream()) {
+    Stream *stream = obj2.getStream();
+    js = new GooString();
+    stream->reset();
+    int i;
+    while ((i = stream->getChar()) != EOF) {
+      js->append((char)i);
+    }
   }
-  GooString *js = new GooString(obj2.getString());
   obj2.free();
   obj.free();
   return js;


More information about the poppler mailing list