[poppler] glib/poppler-structure-element.cc glib/poppler-structure-element.h
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Thu Feb 27 03:13:23 PST 2014
glib/poppler-structure-element.cc | 12 +++++++-----
glib/poppler-structure-element.h | 1 -
2 files changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 7a2db63b5f7cae4bc215baa0859c4d4f8a660951
Author: Adrian Perez de Castro <aperez at igalia.com>
Date: Wed Feb 26 20:16:29 2014 +0200
glib: Remove unneeded POPPLER_STRUCTURE_ELEMENT_UNKNOWN
The enum value POPPLER_STRUCTURE_ELEMENT_UNKNOWN because Poppler does
not add invalid StructElements ("invalid" being nodes of type
StructElement::Unknown) to the Tagged-PDF structure tree. That means
that poppler-glib does not need to expose it in the API. An assertion
is left to aid in finding issues when using debug builds.
https://bugs.freedesktop.org/show_bug.cgi?id=75541
diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index ba81b3c..60bb6c2 100644
--- a/glib/poppler-structure-element.cc
+++ b/glib/poppler-structure-element.cc
@@ -104,13 +104,11 @@ poppler_structure_element_class_init (PopplerStructureElementClass *klass)
PopplerStructureElementKind
poppler_structure_element_get_kind (PopplerStructureElement *poppler_structure_element)
{
- g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), POPPLER_STRUCTURE_ELEMENT_UNKNOWN);
- g_return_val_if_fail (poppler_structure_element->elem != NULL, POPPLER_STRUCTURE_ELEMENT_UNKNOWN);
+ g_return_val_if_fail (POPPLER_IS_STRUCTURE_ELEMENT (poppler_structure_element), POPPLER_STRUCTURE_ELEMENT_CONTENT);
+ g_return_val_if_fail (poppler_structure_element->elem != NULL, POPPLER_STRUCTURE_ELEMENT_CONTENT);
switch (poppler_structure_element->elem->getType ())
{
- case StructElement::Unknown:
- return POPPLER_STRUCTURE_ELEMENT_UNKNOWN;
case StructElement::MCID:
return POPPLER_STRUCTURE_ELEMENT_CONTENT;
case StructElement::OBJR:
@@ -213,10 +211,14 @@ poppler_structure_element_get_kind (PopplerStructureElement *poppler_structure_e
return POPPLER_STRUCTURE_ELEMENT_FORMULA;
case StructElement::Form:
return POPPLER_STRUCTURE_ELEMENT_FORM;
+
+ /* There should never be elements of type StructElement::Unknown */
+ case StructElement::Unknown:
+ g_assert_not_reached ();
}
g_assert_not_reached ();
- return POPPLER_STRUCTURE_ELEMENT_UNKNOWN;
+ return POPPLER_STRUCTURE_ELEMENT_CONTENT;
}
/**
diff --git a/glib/poppler-structure-element.h b/glib/poppler-structure-element.h
index 9279167..249db58 100644
--- a/glib/poppler-structure-element.h
+++ b/glib/poppler-structure-element.h
@@ -33,7 +33,6 @@ G_BEGIN_DECLS
* PopplerStructureElementKind:
*/
typedef enum {
- POPPLER_STRUCTURE_ELEMENT_UNKNOWN,
POPPLER_STRUCTURE_ELEMENT_CONTENT,
POPPLER_STRUCTURE_ELEMENT_OBJECT_REFERENCE,
POPPLER_STRUCTURE_ELEMENT_DOCUMENT,
More information about the poppler
mailing list