poppler/Catalog.cc | 12 ++++++++++++ poppler/Catalog.h | 2 ++ 2 files changed, 14 insertions(+)
New commits: commit 47605a8aaf85bee21601219b04c0c8e6cf982507 Author: José Aliste <[email protected]> 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 <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> // Copyright (C) 2013 Julien Nabet <[email protected]> +// Copyright (C) 2013 José Aliste <[email protected]> // // 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 <[email protected]> // Copyright (C) 2012 Fabio D'Urso <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> +// Copyright (C) 2013 José Aliste <[email protected]> // // 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); };
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
