[PATCH] Compiler warning fixes



This patch mostly fixes unused variable warnings (by deleting the
declaration) and missing includes.

Also there are some BAD_CAST / (const char*) casts added for
interaction with libxml and sqlite.

Finally there's a logic error in yelp-man-parser.c that's fixed, which
could have resulted in a segfault if the two arguments to
right_truncate_common were equal strings.

After this, the compilation emits one warning for yelp-window.c (for
an overly long string literal) and a load of warnings from WebKit's
include files because they finish enums with commas. Grr.
---
 libyelp/yelp-bz2-decompressor.c  |    1 -
 libyelp/yelp-docbook-document.c  |   12 +++---
 libyelp/yelp-document.c          |    9 ++++-
 libyelp/yelp-help-list.c         |   20 ++++++----
 libyelp/yelp-location-entry.c    |    9 +----
 libyelp/yelp-lzma-decompressor.c |    1 -
 libyelp/yelp-mallard-document.c  |   71 +++++++++++++++++++------------------
 libyelp/yelp-man-parser.c        |    6 ++--
 libyelp/yelp-settings.c          |    3 --
 libyelp/yelp-simple-document.c   |    2 -
 libyelp/yelp-sqlite-storage.c    |    2 +-
 libyelp/yelp-transform.c         |    4 --
 libyelp/yelp-uri.c               |    1 -
 libyelp/yelp-view.c              |    5 +--
 src/yelp-application.c           |    2 +-
 src/yelp-window.c                |    2 +-
 16 files changed, 71 insertions(+), 79 deletions(-)

diff --git a/libyelp/yelp-bz2-decompressor.c b/libyelp/yelp-bz2-decompressor.c
index 98802ce..89dbe35 100644
--- a/libyelp/yelp-bz2-decompressor.c
+++ b/libyelp/yelp-bz2-decompressor.c
@@ -128,7 +128,6 @@ yelp_bz2_decompressor_convert (GConverter *converter,
                                GError    **error)
 {
     YelpBz2Decompressor *decompressor;
-    gsize header_size;
     int res;
 
     decompressor = YELP_BZ2_DECOMPRESSOR (converter);
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index 7b8dc68..353018e 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -36,6 +36,7 @@
 #include "yelp-settings.h"
 #include "yelp-transform.h"
 #include "yelp-debug.h"
+#include "yelp-storage.h"
 
 #define STYLESHEET DATADIR"/yelp/xslt/db2html.xsl"
 #define DEFAULT_CATALOG "file:///etc/xml/catalog"
@@ -646,7 +647,6 @@ static gchar *
 docbook_walk_get_title (YelpDocbookDocument *docbook,
                         xmlNodePtr           cur)
 {
-    YelpDocbookDocumentPrivate *priv = GET_PRIV (docbook);
     gchar *infoname = NULL;
     xmlNodePtr child = NULL;
     xmlNodePtr title = NULL;
@@ -755,7 +755,7 @@ docbook_walk_get_title (YelpDocbookDocument *docbook,
 
     if (title) {
         xmlChar *title_s = xmlNodeGetContent (title);
-        gchar *ret = g_strdup (title_s);
+        gchar *ret = g_strdup ((const char*) title_s);
         xmlFree (title_s);
         return ret;
     }
@@ -887,7 +887,6 @@ static void
 docbook_index_node (DocbookIndexData *index)
 {
     xmlNodePtr oldcur, child;
-    YelpDocbookDocumentPrivate *priv = GET_PRIV (index->docbook);
 
     if ((g_str_equal (index->cur->parent->name, "menuchoice") ||
          g_str_equal (index->cur->parent->name, "keycombo")) &&
@@ -895,11 +894,12 @@ docbook_index_node (DocbookIndexData *index)
         g_string_append_c (index->str, ' ');
     }
     if (index->cur->type == XML_TEXT_NODE) {
-        g_string_append (index->str, index->cur->content);
+        g_string_append (index->str,
+                         (const char*) index->cur->content);
         return;
     }
     if (index->cur->type != XML_ELEMENT_NODE ||
-        g_str_has_suffix (index->cur->name, "info") ||
+        g_str_has_suffix ((const char*) index->cur->name, "info") ||
         g_str_equal (index->cur->name, "remark"))
         return;
     oldcur = index->cur;
@@ -928,7 +928,7 @@ docbook_index_chunk (DocbookIndexData *index)
         index->str = g_string_new ("");
     }
 
-    for (child = index->cur->children; child = child->next; child) {
+    for (child = index->cur->children; child != NULL; child = child->next) {
         if (docbook_walk_chunkQ (index->docbook, child, index->depth, index->max_depth)) {
             chunks = g_slist_append (chunks, child);
         }
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index ef7af96..22a68c0 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -231,6 +231,13 @@ yelp_document_get_for_uri (YelpUri *uri)
     case YELP_URI_DOCUMENT_TYPE_EXTERNAL:
     case YELP_URI_DOCUMENT_TYPE_ERROR:
         break;
+    case YELP_URI_DOCUMENT_TYPE_UNRESOLVED:
+        /*
+          This will never happen since we check yelp_uri_is_resolved()
+          above, but the compiler isn't bright enough to know that, so
+          deal with the case here.
+        */
+        break;
     }
 
     if (document != NULL) {
@@ -891,7 +898,7 @@ document_read_contents (YelpDocument *document,
 
         colors = yelp_settings_get_colors (yelp_settings_get_default ());
         g_string_append_printf (ret,
-                                "html { height: 100%; } "
+                                "html { height: 100%%; } "
                                 "body { margin: 0; padding: 0;"
                                 " background-color: %s; color: %s;"
                                 " direction: %s; } "
diff --git a/libyelp/yelp-help-list.c b/libyelp/yelp-help-list.c
index 7b17798..aad8c8d 100644
--- a/libyelp/yelp-help-list.c
+++ b/libyelp/yelp-help-list.c
@@ -31,6 +31,7 @@
 #include <libxml/parser.h>
 #include <libxml/xinclude.h>
 #include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
 
 #include "yelp-help-list.h"
 #include "yelp-settings.h"
@@ -131,15 +132,18 @@ yelp_help_list_init (YelpHelpList *list)
                                            g_free,
                                            (GDestroyNotify) help_list_entry_free);
 
-    priv->get_docbook_title = xmlXPathCompile ("normalize-space("
+    priv->get_docbook_title = xmlXPathCompile (BAD_CAST
+                                               "normalize-space("
                                                "( /*/title | /*/db:title"
                                                "| /*/articleinfo/title"
                                                "| /*/bookinfo/title"
                                                "| /*/db:info/db:title"
                                                ")[1])");
-    priv->get_mallard_title = xmlXPathCompile ("normalize-space((/mal:page/mal:info/mal:title[@type='text'] |"
+    priv->get_mallard_title = xmlXPathCompile (BAD_CAST
+                                               "normalize-space((/mal:page/mal:info/mal:title[@type='text'] |"
                                                "                 /mal:page/mal:title)[1])");
-    priv->get_mallard_desc = xmlXPathCompile ("normalize-space(/mal:page/mal:info/mal:desc[1])");
+    priv->get_mallard_desc = xmlXPathCompile (BAD_CAST
+                                              "normalize-space(/mal:page/mal:info/mal:desc[1])");
 
     yelp_document_set_page_id ((YelpDocument *) list, NULL, "index");
     yelp_document_set_page_id ((YelpDocument *) list, "index", "index");
@@ -225,7 +229,7 @@ help_list_think (YelpHelpList *list)
     YelpHelpListPrivate *priv = GET_PRIV (list);
     /* The strings are still owned by GLib; we just own the array. */
     gchar **datadirs;
-    gint datadir_i, subdir_i, lang_i;
+    gint datadir_i, lang_i;
     GList *cur;
     GtkIconTheme *theme;
 
@@ -248,7 +252,7 @@ help_list_think (YelpHelpList *list)
             g_free (helpdirname);
             continue;
         }
-        while (child = g_file_enumerator_next_file (children, NULL, NULL)) {
+        while ((child = g_file_enumerator_next_file (children, NULL, NULL))) {
             gchar *docid;
             HelpListEntry *entry = NULL;
 
@@ -561,7 +565,7 @@ help_list_process_docbook (YelpHelpList  *list,
     obj = xmlXPathCompiledEval (priv->get_docbook_title, xpath);
     if (obj) {
         if (obj->stringval)
-            entry->title = g_strdup (obj->stringval);
+            entry->title = g_strdup ((const char*) obj->stringval);
         xmlXPathFreeObject (obj);
     }
 
@@ -601,14 +605,14 @@ help_list_process_mallard (YelpHelpList  *list,
     obj = xmlXPathCompiledEval (priv->get_mallard_title, xpath);
     if (obj) {
         if (obj->stringval)
-            entry->title = g_strdup (obj->stringval);
+            entry->title = g_strdup ((const char*) obj->stringval);
         xmlXPathFreeObject (obj);
     }
 
     obj = xmlXPathCompiledEval (priv->get_mallard_desc, xpath);
     if (obj) {
         if (obj->stringval)
-            entry->desc = g_strdup (obj->stringval);
+            entry->desc = g_strdup ((const char*) obj->stringval);
         xmlXPathFreeObject (obj);
     }
 
diff --git a/libyelp/yelp-location-entry.c b/libyelp/yelp-location-entry.c
index 493dab2..5317cab 100644
--- a/libyelp/yelp-location-entry.c
+++ b/libyelp/yelp-location-entry.c
@@ -813,7 +813,6 @@ location_entry_set_entry (YelpLocationEntry *entry, gboolean emit)
                                                icon_name);
         }
         if (priv->bookmarks && doc_uri && page_id) {
-            GdkPixbuf *pixbuf;
             if (!yelp_bookmarks_is_bookmarked (priv->bookmarks, doc_uri, page_id)) {
                 gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->text_entry),
                                                    GTK_ENTRY_ICON_SECONDARY,
@@ -927,7 +926,6 @@ combo_box_row_separator_func (GtkTreeModel  *model,
                               GtkTreeIter   *iter,
                               gpointer       user_data)
 {
-    YelpLocationEntryPrivate *priv = GET_PRIV (user_data);
     gint flags;
     gtk_tree_model_get (model, iter,
                         HISTORY_COL_FLAGS, &flags,
@@ -953,7 +951,6 @@ entry_focus_in_cb (GtkWidget     *widget,
                    GdkEventFocus *event,
                    gpointer       user_data)
 {
-    GtkEntry *text_entry = GTK_ENTRY (widget);
     YelpLocationEntryPrivate *priv = GET_PRIV (user_data);
 
     if (priv->enable_search && !priv->search_mode)
@@ -1036,7 +1033,6 @@ cell_set_text_cell (GtkCellLayout     *layout,
                     YelpLocationEntry *entry)
 {
     gchar *title, *desc, *color, *text;
-    YelpLocationEntryPrivate *priv = GET_PRIV (entry);
 
     gtk_tree_model_get (model, iter,
                         HISTORY_COL_TITLE, &title,
@@ -1128,7 +1124,6 @@ cell_set_completion_text_cell (GtkCellLayout     *layout,
                                YelpLocationEntry *entry)
 {
     gchar *title, *desc, *color, *text;
-    YelpLocationEntryPrivate *priv = GET_PRIV (entry);
 
     gtk_tree_model_get (model, iter,
                         COMPLETION_COL_TITLE, &title,
@@ -1162,7 +1157,6 @@ entry_match_func (GtkEntryCompletion *completion,
     gboolean ret = FALSE;
     gchar **strs;
     GtkTreeModel *model = gtk_entry_completion_get_model (completion);
-    YelpLocationEntryPrivate *priv = GET_PRIV (entry);
     static GRegex *nonword = NULL;
 
     if (nonword == NULL)
@@ -1350,7 +1344,7 @@ view_uri_selected (YelpView          *view,
     gchar *iter_uri;
     gboolean cont;
     YelpUri *uri;
-    gchar *struri, *doc_uri;
+    gchar *struri;
     YelpLocationEntryPrivate *priv = GET_PRIV (entry);
 
     g_object_get (G_OBJECT (view), "yelp-uri", &uri, NULL);
@@ -1419,7 +1413,6 @@ view_page_title (YelpView          *view,
     if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->history), &first)) {
         gchar *title, *frag = NULL;
         YelpViewState state;
-        YelpUri *uri;
 
         g_object_get (view,
                       "page-title", &title,
diff --git a/libyelp/yelp-lzma-decompressor.c b/libyelp/yelp-lzma-decompressor.c
index b304cde..13f156e 100644
--- a/libyelp/yelp-lzma-decompressor.c
+++ b/libyelp/yelp-lzma-decompressor.c
@@ -137,7 +137,6 @@ yelp_lzma_decompressor_convert (GConverter *converter,
                                 GError    **error)
 {
     YelpLzmaDecompressor *decompressor;
-    gsize header_size;
     lzma_ret res;
 
     decompressor = YELP_LZMA_DECOMPRESSOR (converter);
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 2c62a7f..dacfe21 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -30,12 +30,14 @@
 #include <libxml/parser.h>
 #include <libxml/parserInternals.h>
 #include <libxml/xinclude.h>
+#include <libxml/xpathInternals.h>
 
 #include "yelp-error.h"
 #include "yelp-mallard-document.h"
 #include "yelp-settings.h"
 #include "yelp-transform.h"
 #include "yelp-debug.h"
+#include "yelp-storage.h"
 
 #define STYLESHEET DATADIR"/yelp/xslt/mal2html.xsl"
 #define MALLARD_NS "http://projectmallard.org/1.0/";
@@ -169,7 +171,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
@@ -494,7 +496,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;
 
@@ -526,10 +529,10 @@ 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,
@@ -564,7 +567,7 @@ mallard_page_data_walk (MallardPageData *page_data)
                     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;
@@ -588,14 +591,13 @@ 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);
@@ -614,7 +616,7 @@ 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 char*) obj->stringval);
                     xmlXPathFreeObject (obj);
                 }
                 if (role != NULL)
@@ -622,29 +624,29 @@ mallard_page_data_info (MallardPageData *page_data,
                 xmlFree (type);
             }
         }
-        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 char*) 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")) {
             xmlChar *type, *next;
 
             xmlAddChild (cache_node, xmlCopyNode (child, 1));
 
             type = xmlGetProp (child, BAD_CAST "type");
             if (type != NULL) {
-                if (xmlStrEqual (type, "next")) {
+                if (xmlStrEqual (type, BAD_CAST "next")) {
                     next = xmlGetProp (child, BAD_CAST "xref");
                     if (next != NULL) {
                         if (page_data->next_page != NULL)
                             g_free (page_data->next_page);
-                        page_data->next_page = g_strdup (next);
+                        page_data->next_page = g_strdup ((const char*) next);
                         xmlFree (next);
                     }
                 }
@@ -652,12 +654,12 @@ mallard_page_data_info (MallardPageData *page_data,
             }
 
         }
-        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));
         }
     }
@@ -668,7 +670,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);
@@ -813,7 +814,7 @@ xml_node_get_icon (xmlNodePtr node)
     style = xmlGetProp (node, BAD_CAST "style");
     if (style) {
         gint i;
-        styles = g_strsplit (style, " ", -1);
+        styles = g_strsplit ((const char*) style, " ", -1);
         for (i = 0; styles[i] != NULL; i++) {
             if (g_str_equal (styles[i], "video")) {
                 icon = "yelp-page-video-symbolic";
@@ -875,28 +876,28 @@ mallard_index_node (MallardIndexData *index)
 
     for (child = index->cur->children; child; child = child->next) {
         if (index->is_inline) {
-            if ((xml_node_is_ns_name (child->parent, MALLARD_NS, BAD_CAST "guiseq") ||
-                 xml_node_is_ns_name (child->parent, MALLARD_NS, BAD_CAST "keyseq")) &&
+            if ((xml_node_is_ns_name (child->parent, BAD_CAST MALLARD_NS, BAD_CAST "guiseq") ||
+                 xml_node_is_ns_name (child->parent, BAD_CAST MALLARD_NS, BAD_CAST "keyseq")) &&
                 child->prev != NULL) {
                 g_string_append_c (index->str, ' ');
             }
             if (child->type == XML_TEXT_NODE) {
-                g_string_append (index->str, child->content);
+                g_string_append (index->str, (const char*) child->content);
                 continue;
             }
         }
 
         if (child->type != XML_ELEMENT_NODE ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "info") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "comment"))
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "info") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "comment"))
             continue;
 
-        if (xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "p") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "code") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "screen") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "title") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "desc") ||
-            xml_node_is_ns_name (child, MALLARD_NS, BAD_CAST "cite")) {
+        if (xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "p") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "code") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "screen") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "title") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "desc") ||
+            xml_node_is_ns_name (child, BAD_CAST MALLARD_NS, BAD_CAST "cite")) {
             index->is_inline = TRUE;
         }
 
@@ -985,7 +986,7 @@ mallard_index_threaded (YelpMallardDocument *mallard)
             if (g_hash_table_lookup (ids, id))
                 goto done;
             /* We never use the value. Just need something non-NULL. */
-            g_hash_table_insert (ids, g_strdup (id), id);
+            g_hash_table_insert (ids, g_strdup ((const char*) id), id);
 
             xpath = xmlXPathNewContext (index->doc);
             xmlXPathRegisterNs (xpath, BAD_CAST "mal", BAD_CAST MALLARD_NS);
@@ -993,12 +994,12 @@ mallard_index_threaded (YelpMallardDocument *mallard)
                                           "normalize-space((/mal:page/mal:info/mal:title[@type='text'] |"
                                           "/mal:page/mal:title)[1])",
                                           xpath);
-            title = g_strdup (obj->stringval);
+            title = g_strdup ((const char*) obj->stringval);
             xmlXPathFreeObject (obj);
             obj = xmlXPathEvalExpression (BAD_CAST
                                           "normalize-space(/mal:page/mal:info/mal:desc[1])",
                                           xpath);
-            desc = g_strdup (obj->stringval);
+            desc = g_strdup ((const char*) obj->stringval);
             xmlXPathFreeObject (obj);
 
             index->str = g_string_new (desc);
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index 4001d38..87cd98f 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -380,7 +380,7 @@ get_troff (gchar *path, GError **error)
                                    NULL, NULL, &stdout, NULL, &err)) {
         /* We failed to run the man program. Return a "Huh?" error. */
         *error = g_error_new (YELP_ERROR, YELP_ERROR_UNKNOWN,
-                              err->message);
+                              "%s", err->message);
         g_error_free (err);
         return NULL;
     }
@@ -1043,12 +1043,12 @@ right_truncate_common (gchar *dst, const gchar *src)
     guint len_src = strlen (src);
     guint len_dst = strlen (dst);
 
-    guint k = (len_src < len_dst) ? len_src - 1 : len_dst - 1;
+    guint k = (len_src < len_dst) ? len_src : len_dst;
 
     dst += len_dst - 1;
     src += len_src - 1;
 
-    while (k >= 0) {
+    while (k >= 1) {
         if (*dst != *src) break;
         *dst = '\0';
 
diff --git a/libyelp/yelp-settings.c b/libyelp/yelp-settings.c
index 8995e60..a18bfd1 100644
--- a/libyelp/yelp-settings.c
+++ b/libyelp/yelp-settings.c
@@ -290,8 +290,6 @@ yelp_settings_constructed (GObject *object)
 static void
 yelp_settings_dispose (GObject *object)
 {
-    YelpSettings *settings = YELP_SETTINGS (object);
-
     G_OBJECT_CLASS (yelp_settings_parent_class)->dispose (object);
 }
 
@@ -854,7 +852,6 @@ gtk_theme_changed (GtkSettings  *gtk_settings,
     GdkColor   blue = { 0, 0x1E1E, 0x3E3E, 0xE7E7 };
     gdouble    base_h, base_s, base_v;
     gdouble    text_h, text_s, text_v;
-    gint i;
 
     g_mutex_lock (settings->priv->mutex);
 
diff --git a/libyelp/yelp-simple-document.c b/libyelp/yelp-simple-document.c
index 8f2dadc..0fba8d5 100644
--- a/libyelp/yelp-simple-document.c
+++ b/libyelp/yelp-simple-document.c
@@ -395,8 +395,6 @@ stream_close_cb (GInputStream       *stream,
 		 GAsyncResult       *result,
 		 YelpSimpleDocument *document)
 {
-    GSList *cur;
-
     document->priv->finished = TRUE;
     document_signal_all (document);
 }
diff --git a/libyelp/yelp-sqlite-storage.c b/libyelp/yelp-sqlite-storage.c
index f2e6619..e7344f3 100644
--- a/libyelp/yelp-sqlite-storage.c
+++ b/libyelp/yelp-sqlite-storage.c
@@ -305,7 +305,7 @@ yelp_sqlite_storage_get_root_title (YelpStorage *storage,
     sqlite3_bind_text (stmt, 1, doc_uri, -1, SQLITE_TRANSIENT);
     sqlite3_bind_text (stmt, 2, g_get_language_names()[0], -1, SQLITE_STATIC);
     if (sqlite3_step (stmt) == SQLITE_ROW)
-        ret = g_strdup (sqlite3_column_text (stmt, 0));
+        ret = g_strdup ((const char*) sqlite3_column_text (stmt, 0));
     sqlite3_finalize (stmt);
 
     g_mutex_unlock (priv->mutex);
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index eecfe6a..b9853b4 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -60,9 +60,6 @@ static void      yelp_transform_set_property (GObject                 *object,
                                               GParamSpec              *pspec);
 
 static void      transform_run              (YelpTransform           *transform);
-static gboolean  transform_free             (YelpTransform           *transform);
-static void      transform_set_error        (YelpTransform           *transform,
-                                             YelpError               *error);
 
 static gboolean  transform_chunk            (YelpTransform           *transform);
 static gboolean  transform_error            (YelpTransform           *transform);
@@ -224,7 +221,6 @@ static void
 yelp_transform_finalize (GObject *object)
 {
     YelpTransformPrivate *priv = GET_PRIV (object);
-    xsltDocumentPtr xsltdoc;
     GHashTableIter iter;
     gpointer chunk;
 
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index 53a550f..052fee4 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -298,7 +298,6 @@ resolve_start (YelpUri *uri)
 static void
 resolve_sync (YelpUri *uri)
 {
-    gchar *tmp;
     YelpUriPrivate *priv = GET_PRIV (uri);
 
     if (g_str_has_prefix (priv->res_arg, "ghelp:")
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 15f6c9f..31e62c9 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -861,7 +861,7 @@ view_scrolled (GtkAdjustment *adjustment,
         return;
     if (adjustment == priv->vadjustment)
         ((YelpBackEntry *) priv->back_cur->data)->vadj = gtk_adjustment_get_value (adjustment);
-    else if (adjustment = priv->hadjustment)
+    else if (adjustment == priv->hadjustment)
         ((YelpBackEntry *) priv->back_cur->data)->hadj = gtk_adjustment_get_value (adjustment);
 }
 
@@ -1412,7 +1412,6 @@ view_resource_request (WebKitWebView         *view,
 {
     YelpViewPrivate *priv = GET_PRIV (view);
     const gchar *requri = webkit_network_request_get_uri (request);
-    gchar last;
     gchar *newpath;
 
     if (!g_str_has_prefix (requri, BOGUS_URI))
@@ -1607,7 +1606,7 @@ view_show_error_page (YelpView *view,
         "</div></div>"
         "</body></html>";
     YelpSettings *settings = yelp_settings_get_default ();
-    gchar *page, *title = NULL, *link = NULL, *title_m, *content_beg, *content_end;
+    gchar *page, *title = NULL, *title_m, *content_beg, *content_end;
     gchar *textcolor, *bgcolor, *noteborder, *notebg, *titlecolor, *noteicon, *linkcolor;
     gint iconsize;
     GParamSpec *spec;
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 94f13ae..43d2518 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -63,7 +63,7 @@ option_version_cb (const gchar *option_name,
 
 static const GOptionEntry entries[] = {
     {"editor-mode", 0, 0, G_OPTION_ARG_NONE, &editor_mode, N_("Turn on editor mode"), NULL},
-    { "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
+    { "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, (gpointer)option_version_cb, NULL, NULL },
     { NULL }
 };
 
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 477c6aa..e857502 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -149,7 +149,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (YelpWindow, yelp_window, GTK_TYPE_WINDOW);
+G_DEFINE_TYPE (YelpWindow, yelp_window, GTK_TYPE_WINDOW)
 #define GET_PRIV(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), YELP_TYPE_WINDOW, YelpWindowPrivate))
 
 static const gchar *YELP_UI =
-- 
1.7.5.1



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