[poppler] [PATCH] glib: Remove unneeded POPPLER_STRUCTURE_ELEMENT_UNKNOWN
Adrian Perez de Castro
aperez at igalia.com
Wed Feb 26 10:22:27 PST 2014
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.
---
glib/poppler-structure-element.cc | 12 +++++++-----
glib/poppler-structure-element.h | 1 -
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index 80a70c0..ae2eedc 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 cafe1bf..b3416f9 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,
--
1.9.0
More information about the poppler
mailing list