[PATCH 08/14] Lots of typecasts and some unused variables.



---
 libyelp/yelp-mallard-document.c |   47 ++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 1bab124..f67bb97 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -162,7 +162,7 @@ yelp_mallard_document_init (YelpMallardDocument *mallard)
     priv->pages_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
                                               NULL,
                                               (GDestroyNotify) mallard_page_data_free);
-    priv->normalize = xmlXPathCompile ("normalize-space(.)");
+    priv->normalize = xmlXPathCompile (BAD_CAST "normalize-space(.)");
 }
 
 static void
@@ -278,7 +278,6 @@ mallard_think (YelpMallardDocument *mallard)
 {
     YelpMallardDocumentPrivate *priv = GET_PRIV (mallard);
     GError *error = NULL;
-    YelpDocument *document;
     gchar **search_path;
     gboolean editor_mode;
 
@@ -300,7 +299,7 @@ mallard_think (YelpMallardDocument *mallard)
         error = g_error_new (YELP_ERROR, YELP_ERROR_NOT_FOUND,
                              _("The directory â??%sâ?? does not exist."),
                              search_path[0]);
-	yelp_document_error_pending ((YelpDocument *) document, error);
+	yelp_document_error_pending ((YelpDocument *) mallard, error);
         g_error_free (error);
 	goto done;
     }
@@ -473,7 +472,8 @@ mallard_page_data_walk (MallardPageData *page_data)
         if (id == NULL)
             goto done;
 
-        ispage = xml_node_is_ns_name (page_data->cur, MALLARD_NS, BAD_CAST "page");
+        ispage = xml_node_is_ns_name (page_data->cur,
+                                      BAD_CAST MALLARD_NS, BAD_CAST "page");
         if (ispage && g_hash_table_lookup (priv->pages_hash, id) != NULL)
             goto done;
 
@@ -494,7 +494,7 @@ mallard_page_data_walk (MallardPageData *page_data)
             style = xmlGetProp (page_data->cur, BAD_CAST "style");
             if (style) {
                 gint i;
-                styles = g_strsplit (style, " ", -1);
+                styles = g_strsplit ((const gchar*) style, " ", -1);
                 for (i = 0; styles[i] != NULL; i++) {
                     if (g_str_equal (styles[i], "task")) {
                         icon = "yelp-page-task";
@@ -531,10 +531,12 @@ mallard_page_data_walk (MallardPageData *page_data)
         for (child = page_data->cur->children; child; child = child->next) {
             if (child->type != XML_ELEMENT_NODE)
                 continue;
-            if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "info")) {
+            if (xml_node_is_ns_name (child,
+                                     BAD_CAST MALLARD_NS, BAD_CAST "info")) {
                 mallard_page_data_info (page_data, child, info);
             }
-            else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "title")) {
+            else if (xml_node_is_ns_name (child,
+                                          BAD_CAST MALLARD_NS, BAD_CAST "title")) {
                 xmlNodePtr node;
                 xmlNodePtr title_node = xmlNewChild (page_data->cache,
                                                      priv->cache_ns,
@@ -565,11 +567,12 @@ mallard_page_data_walk (MallardPageData *page_data)
                     xmlXPathObjectPtr obj;
                     page_data->xpath->node = child;
                     obj = xmlXPathCompiledEval (priv->normalize, page_data->xpath);
-                    page_data->page_title = g_strdup (obj->stringval);
+                    page_data->page_title = g_strdup ((const gchar*) obj->stringval);
                     xmlXPathFreeObject (obj);
                 }
             }
-            else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "section")) {
+            else if (xml_node_is_ns_name (child,
+                                          BAD_CAST MALLARD_NS, BAD_CAST "section")) {
                 oldcur = page_data->cur;
                 oldcache = page_data->cache;
                 page_data->cur = child;
@@ -593,14 +596,15 @@ mallard_page_data_info (MallardPageData *page_data,
                         xmlNodePtr       cache_node)
 {
     xmlNodePtr child;
-    gboolean editor_mode = yelp_settings_get_editor_mode (yelp_settings_get_default ());
 
     for (child = info_node->children; child; child = child->next) {
-        if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "info")) {
+        if (xml_node_is_ns_name (child,
+                                 BAD_CAST MALLARD_NS, BAD_CAST "info")) {
             mallard_page_data_info (page_data, child, cache_node);
         }
-        else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "title")) {
-            xmlNodePtr node, title_node;
+        else if (xml_node_is_ns_name (child,
+                                      BAD_CAST MALLARD_NS, BAD_CAST "title")) {
+            xmlNodePtr title_node;
             xmlChar *type, *role;
             title_node = xmlCopyNode (child, 1);
             xmlAddChild (cache_node, title_node);
@@ -618,29 +622,29 @@ mallard_page_data_info (MallardPageData *page_data,
                 page_data->xpath->node = child;
                 obj = xmlXPathCompiledEval (priv->normalize, page_data->xpath);
                 g_free (page_data->page_title);
-                page_data->page_title = g_strdup (obj->stringval);
+                page_data->page_title = g_strdup ((const gchar*) obj->stringval);
                 xmlXPathFreeObject (obj);
             }
         }
-        else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "desc")) {
+        else if (xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "desc")) {
             YelpMallardDocumentPrivate *priv = GET_PRIV (page_data->mallard);
             xmlXPathObjectPtr obj;
             page_data->xpath->node = child;
             obj = xmlXPathCompiledEval (priv->normalize, page_data->xpath);
-            page_data->page_desc = g_strdup (obj->stringval);
+            page_data->page_desc = g_strdup ((const gchar*) obj->stringval);
             xmlXPathFreeObject (obj);
 
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
         }
-        else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "link")) {
+        else if (xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "link")) {
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
         }
-        else if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "revision")) {
+        else if (xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "revision")) {
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
         }
-        else if (xml_node_is_ns_name (child, MALLARD_FACET_NS, BAD_CAST "tag") ||
-                 xml_node_is_ns_name (child, MALLARD_FACET_NS, BAD_CAST "match") ||
-                 xml_node_is_ns_name (child, MALLARD_FACET_NS, BAD_CAST "choice") ) {
+        else if (xml_node_is_ns_name (child, BAD_CAST MALLARD_FACET_NS, BAD_CAST "tag") ||
+                 xml_node_is_ns_name (child, BAD_CAST MALLARD_FACET_NS, BAD_CAST "match") ||
+                 xml_node_is_ns_name (child, BAD_CAST MALLARD_FACET_NS, BAD_CAST "choice") ) {
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
         }
     }
@@ -651,7 +655,6 @@ mallard_page_data_run (MallardPageData *page_data)
 {
     YelpSettings *settings = yelp_settings_get_default ();
     YelpMallardDocumentPrivate *priv = GET_PRIV (page_data->mallard);
-    gint i, ix;
     gchar **params = NULL;
 
     mallard_page_data_cancel (page_data);
-- 
1.7.2.3




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]