[poppler] Branch 'poppler-0.24' - poppler/Catalog.cc poppler/Catalog.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Nov 18 13:52:33 PST 2013
poppler/Catalog.cc | 12 ++++++++++++
poppler/Catalog.h | 2 ++
2 files changed, 14 insertions(+)
New commits:
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);
};
More information about the poppler
mailing list