[poppler] glib/poppler-structure-element.cc glib/poppler-structure-element.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Feb 22 00:24:22 PST 2014


 glib/poppler-structure-element.cc |   25 +++++++++++++++++++------
 glib/poppler-structure-element.h  |    9 +++++++--
 2 files changed, 26 insertions(+), 8 deletions(-)

New commits:
commit 6fbd6cb85bdd32dc5a3d4c3c719556269a4488ac
Author: Adrian Perez de Castro <aperez at igalia.com>
Date:   Fri Feb 21 15:02:44 2014 +0200

    glib: Handle missing structure element types
    
    Element Art (article); RB, RP, RB (Ruby text inner elements); and
    WT, WP (Warichu inner elements) were not being handled. This adds
    the corresponding handling in poppler-glib. Also, the "default" case
    in the switch in poppler_structure_element_get_type() is removed, so
    the compiler can emit warnings when enum values are not handled.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=75323

diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc
index 39dfd51..a44791a 100644
--- a/glib/poppler-structure-element.cc
+++ b/glib/poppler-structure-element.cc
@@ -119,6 +119,8 @@ poppler_structure_element_get_kind (PopplerStructureElement *poppler_structure_e
         return POPPLER_STRUCTURE_ELEMENT_DOCUMENT;
       case StructElement::Part:
         return POPPLER_STRUCTURE_ELEMENT_PART;
+      case StructElement::Art:
+        return POPPLER_STRUCTURE_ELEMENT_ARTICLE;
       case StructElement::Sect:
         return POPPLER_STRUCTURE_ELEMENT_SECTION;
       case StructElement::Div:
@@ -139,10 +141,6 @@ poppler_structure_element_get_kind (PopplerStructureElement *poppler_structure_e
         return POPPLER_STRUCTURE_ELEMENT_LINK;
       case StructElement::Annot:
         return POPPLER_STRUCTURE_ELEMENT_ANNOT;
-      case StructElement::Ruby:
-        return POPPLER_STRUCTURE_ELEMENT_RUBY;
-      case StructElement::Warichu:
-        return POPPLER_STRUCTURE_ELEMENT_WARICHU;
       case StructElement::BlockQuote:
         return POPPLER_STRUCTURE_ELEMENT_BLOCKQUOTE;
       case StructElement::Caption:
@@ -195,15 +193,30 @@ poppler_structure_element_get_kind (PopplerStructureElement *poppler_structure_e
         return POPPLER_STRUCTURE_ELEMENT_TABLE_FOOTER;
       case StructElement::TBody:
         return POPPLER_STRUCTURE_ELEMENT_TABLE_BODY;
+      case StructElement::Ruby:
+        return POPPLER_STRUCTURE_ELEMENT_RUBY;
+      case StructElement::RB:
+        return POPPLER_STRUCTURE_ELEMENT_RUBY_BASE_TEXT;
+      case StructElement::RT:
+        return POPPLER_STRUCTURE_ELEMENT_RUBY_ANNOT_TEXT;
+      case StructElement::RP:
+        return POPPLER_STRUCTURE_ELEMENT_RUBY_PUNCTUATION;
+      case StructElement::Warichu:
+        return POPPLER_STRUCTURE_ELEMENT_WARICHU;
+      case StructElement::WT:
+        return POPPLER_STRUCTURE_ELEMENT_WARICHU_TEXT;
+      case StructElement::WP:
+        return POPPLER_STRUCTURE_ELEMENT_WARICHU_PUNCTUATION;
       case StructElement::Figure:
         return POPPLER_STRUCTURE_ELEMENT_FIGURE;
       case StructElement::Formula:
         return POPPLER_STRUCTURE_ELEMENT_FORMULA;
       case StructElement::Form:
         return POPPLER_STRUCTURE_ELEMENT_FORM;
-      default:
-        g_assert_not_reached ();
     }
+
+  g_assert_not_reached ();
+  return POPPLER_STRUCTURE_ELEMENT_UNKNOWN;
 }
 
 /**
diff --git a/glib/poppler-structure-element.h b/glib/poppler-structure-element.h
index 7ba5d56..e6412f5 100644
--- a/glib/poppler-structure-element.h
+++ b/glib/poppler-structure-element.h
@@ -49,8 +49,6 @@ typedef enum {
   POPPLER_STRUCTURE_ELEMENT_CODE,
   POPPLER_STRUCTURE_ELEMENT_LINK,
   POPPLER_STRUCTURE_ELEMENT_ANNOT,
-  POPPLER_STRUCTURE_ELEMENT_RUBY,
-  POPPLER_STRUCTURE_ELEMENT_WARICHU,
   POPPLER_STRUCTURE_ELEMENT_BLOCKQUOTE,
   POPPLER_STRUCTURE_ELEMENT_CAPTION,
   POPPLER_STRUCTURE_ELEMENT_NONSTRUCT,
@@ -77,6 +75,13 @@ typedef enum {
   POPPLER_STRUCTURE_ELEMENT_TABLE_HEADER,
   POPPLER_STRUCTURE_ELEMENT_TABLE_FOOTER,
   POPPLER_STRUCTURE_ELEMENT_TABLE_BODY,
+  POPPLER_STRUCTURE_ELEMENT_RUBY,
+  POPPLER_STRUCTURE_ELEMENT_RUBY_BASE_TEXT,
+  POPPLER_STRUCTURE_ELEMENT_RUBY_ANNOT_TEXT,
+  POPPLER_STRUCTURE_ELEMENT_RUBY_PUNCTUATION,
+  POPPLER_STRUCTURE_ELEMENT_WARICHU,
+  POPPLER_STRUCTURE_ELEMENT_WARICHU_TEXT,
+  POPPLER_STRUCTURE_ELEMENT_WARICHU_PUNCTUATION,
   POPPLER_STRUCTURE_ELEMENT_FIGURE,
   POPPLER_STRUCTURE_ELEMENT_FORMULA,
   POPPLER_STRUCTURE_ELEMENT_FORM,


More information about the poppler mailing list