[poppler] 3 commits - poppler/Catalog.cc poppler/Catalog.h utils/pdftotext.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Nov 18 13:59:40 PST 2013


 poppler/Catalog.cc |   12 ++++++++++++
 poppler/Catalog.h  |    2 ++
 utils/pdftotext.cc |    6 ++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit c01cee165392ba8297e4168111a66d2acb272a99
Merge: 07c2554 47605a8
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Nov 18 22:58:28 2013 +0100

    Merge remote-tracking branch 'origin/poppler-0.24'
    
    Conflicts:
    	poppler/Catalog.cc
    	poppler/Catalog.h

diff --cc poppler/Catalog.cc
index a06ae5f,f17f2c0..4464346
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@@ -27,8 -27,7 +27,9 @@@
  // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
  // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
  // Copyright (C) 2013 Julien Nabet <serval2412 at yahoo.fr>
 +// Copyright (C) 2013 Adrian Perez de Castro <aperez at igalia.com>
 +// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+ // Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
  //
  // To see a description of the changes please see the Changelog file that
  // came with your tarball or type make ChangeLog if you are building from git
diff --cc poppler/Catalog.h
index 40c783c,384f634..bc9ce20
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@@ -22,8 -22,7 +22,9 @@@
  // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
  // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
  // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 +// Copyright (C) 2013 Adrian Perez de Castro <aperez at igalia.com>
 +// Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
+ // Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
  //
  // To see a description of the changes please see the Changelog file that
  // came with your tarball or type make ChangeLog if you are building from git
commit 47605a8aaf85bee21601219b04c0c8e6cf982507
Author: José Aliste <jaliste at src.gnome.org>
Date:   Mon Nov 18 22:52:08 2013 +0100

    Catalog: sort entries of NameTrees to make sure lookup works
    
    Bug #26049

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 6bd511a..f17f2c0 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -27,6 +27,7 @@
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013 Julien Nabet <serval2412 at yahoo.fr>
+// Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -657,9 +658,20 @@ void NameTree::addEntry(Entry *entry)
   ++length;
 }
 
+int NameTree::Entry::cmpEntry(const void *voidEntry, const void *voidOtherEntry)
+{
+  Entry *entry = *(NameTree::Entry **) voidEntry;
+  Entry *otherEntry = *(NameTree::Entry **) voidOtherEntry;
+
+  return entry->name.cmp(&otherEntry->name);
+}
+
 void NameTree::init(XRef *xrefA, Object *tree) {
   xref = xrefA;
   parse(tree);
+  if (entries && length > 0) {
+    qsort(entries, length, sizeof(Entry *), Entry::cmpEntry);
+  }
 }
 
 void NameTree::parse(Object *tree) {
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 24a3dcf..384f634 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -22,6 +22,7 @@
 // Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2013 José Aliste <jaliste at src.gnome.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -76,6 +77,7 @@ private:
     GooString name;
     Object value;
     void free();
+    static int cmpEntry(const void *voidEntry, const void *voidOtherEntry);
     static int cmp(const void *key, const void *entry);
   };
 
commit 491f0a170c72271a7a9ce049fbcfe81f08cff162
Author: suzuki toshiya <mpsuzuki at hiroshima-u.ac.jp>
Date:   Fri Nov 15 20:35:12 2013 +0100

    pdftotext: Escape the text of the xml headers

diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 62ba3a3..bd687ec 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -439,7 +439,7 @@ static void printInfoString(FILE *f, Dict *infoDict, const char *key,
   GooString *s1;
   GBool isUnicode;
   Unicode u;
-  char buf[8];
+  char buf[9];
   int i, n;
 
   if (infoDict->lookup(key, &obj)->isString()) {
@@ -463,7 +463,9 @@ static void printInfoString(FILE *f, Dict *infoDict, const char *key,
 	++i;
       }
       n = uMap->mapUnicode(u, buf, sizeof(buf));
-      fwrite(buf, 1, n, f);
+      buf[n] = '\0';
+      const std::string myString = myXmlTokenReplace(buf);
+      fputs(myString.c_str(), f);
     }
     fputs(text2, f);
   }


More information about the poppler mailing list