[poppler] poppler/PDFDoc.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Jul 21 14:16:23 PDT 2011


 poppler/PDFDoc.cc |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit ec6ea621b066a3b332a8099341664889d2ff3743
Author: Axel Struebing <axel.struebing at freenet.de>
Date:   Thu Jul 21 23:12:36 2011 +0200

    Fix calculation of startXRefPos
    
    Reviewed by Hib Eris
    See "another problem with saving linearized files" in the mailing list for more info

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 58356e6..b861c5d 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1084,12 +1084,15 @@ Guint PDFDoc::getStartXRef()
       }
       buf[n] = '\0';
 
-      // find end of first obj
+      // find end of first obj (linearization dictionary)
       startXRefPos = 0;
       for (i = 0; i < n; i++) {
         if (!strncmp("endobj", &buf[i], 6)) {
-           startXRefPos = i+6;
-           break;
+	  i += 6;
+	  //skip whitespace 
+	  while (buf[i] && Lexer::isSpace(buf[i])) ++i;
+	  startXRefPos = i;
+	  break;
         }
       }
     } else {


More information about the poppler mailing list