poppler/Lexer.cc |   43 +++++++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 22 deletions(-)

New commits:
commit 76295f4d401c36bdef3b2a20d18ac57a3b976410
Author: Albert Astals Cid <[email protected]>
Date:   Thu Oct 27 19:42:42 2011 +0200

    xpdf303: Adopt xpdf solution for the name too long problem

diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index e4d8641..efdc076 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -432,30 +432,27 @@ Object *Lexer::getObj(Object *obj, int objNum) {
        }
       }
      notEscChar:
-      if (n == tokBufSize) {
-       if (!s)
-       {
-         error(errSyntaxError, getPos(), "Warning: name token is longer than 
what the specification says it can be");
-         s = new GooString(tokBuf, tokBufSize);
-       }
-       else
-       {
-         // the spec says 127 is the maximum, we are already at 256 so bail out
-         error(errSyntaxError, getPos(), "Name token too long");
-         break;
-       }
-       p = tokBuf;
-       n = 0;
-      }
-      *p++ = c;
+      // the PDF spec claims that names are limited to 127 chars, but
+      // Distiller 8 will produce longer names, and Acrobat 8 will
+      // accept longer names
       ++n;
+      if (n < tokBufSize) {
+       *p++ = c;
+      } else if (n == tokBufSize) {
+       error(errSyntaxError, getPos(), "Warning: name token is longer than 
what the specification says it can be");
+       *p = c;
+       s = new GString(tokBuf, n);
+      } else {
+       s->append((char)c);
+      }
     }
-    *p = '\0';
-    if (s) {
-      s->append(tokBuf, n);
+    if (n < tokBufSize) {
+      *p = '\0';
+      obj->initName(tokBuf);
+    } else {
       obj->initName(s->getCString());
       delete s;
-    } else obj->initName(tokBuf);
+    }
     break;
 
   // array punctuation
commit be6d4c19b8ce1515ce995eee408dc5752012c649
Author: Albert Astals Cid <[email protected]>
Date:   Thu Oct 27 19:34:38 2011 +0200

    xpdf303: Add brackets

diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index 9864244..e4d8641 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -228,8 +228,9 @@ Object *Lexer::getObj(Object *obj, int objNum) {
        break;
       }
     }
-    if (neg)
+    if (neg) {
       xi = -xi;
+    }
     if (unlikely(overflownInteger)) {
       if (overflownUnsignedInteger) {
         obj->initError();
@@ -263,8 +264,9 @@ Object *Lexer::getObj(Object *obj, int objNum) {
       xf = xf + scale * (c - '0');
       scale *= 0.1;
     }
-    if (neg)
+    if (neg) {
       xf = -xf;
+    }
     obj->initReal(xf);
     break;
 
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to