summaryrefslogtreecommitdiff
path: root/desktop/options.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-02-25 17:58:00 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-02-25 17:58:00 +0000
commit1cf46a6792a9e243edb857e131e44338bcbbd341 (patch)
tree9d145155307f4bc19746e486c7cd49ef897a49a1 /desktop/options.c
parent674591f63df9c9b1e8e02aef4992a24b39cda0fc (diff)
downloadnetsurf-1cf46a6792a9e243edb857e131e44338bcbbd341.tar.gz
netsurf-1cf46a6792a9e243edb857e131e44338bcbbd341.tar.bz2
SignednessWarnings.squash()
Aside from a number of instances of const being cast away (mostly relating to the urldb, which is correct to only export const data) this now builds warning-free with GCC 4 on x86, which is nice. svn path=/trunk/netsurf/; revision=3868
Diffstat (limited to 'desktop/options.c')
-rw-r--r--desktop/options.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/desktop/options.c b/desktop/options.c
index d3eba4c8e..33a6932f5 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -428,11 +428,11 @@ void options_load_tree_directory(xmlNode *ul, struct node *directory) {
if (n->type != XML_ELEMENT_NODE)
continue;
- if (strcmp(n->name, "li") == 0) {
+ if (strcmp((const char *) n->name, "li") == 0) {
/* entry */
options_load_tree_entry(n, directory);
- } else if (strcmp(n->name, "h4") == 0) {
+ } else if (strcmp((const char *) n->name, "h4") == 0) {
/* directory */
title = (char *) xmlNodeGetContent(n);
if (!title) {
@@ -445,7 +445,7 @@ void options_load_tree_directory(xmlNode *ul, struct node *directory) {
n && n->type != XML_ELEMENT_NODE;
n = n->next)
;
- if (!n || strcmp(n->name, "ul") != 0) {
+ if (!n || strcmp((const char *) n->name, "ul") != 0) {
/* next element isn't expected ul */
free(title);
warn_user("HotlistLoadError", "(Expected "
@@ -478,7 +478,7 @@ void options_load_tree_entry(xmlNode *li, struct node *directory) {
for (n = li->children; n; n = n->next) {
/* The li must contain an "a" element */
if (n->type == XML_ELEMENT_NODE &&
- strcmp(n->name, "a") == 0) {
+ strcmp((const char *) n->name, "a") == 0) {
url = (char *) xmlGetProp(n, (const xmlChar *) "href");
title = (char *) xmlNodeGetContent(n);
}
@@ -526,7 +526,7 @@ xmlNode *options_find_tree_element(xmlNode *node, const char *name) {
return 0;
for (n = node->children;
n && !(n->type == XML_ELEMENT_NODE &&
- strcmp(n->name, name) == 0);
+ strcmp((const char *) n->name, name) == 0);
n = n->next)
;
return n;
@@ -545,14 +545,15 @@ bool options_save_tree(struct tree *tree, const char *filename, const char *page
/* Unfortunately the Browse Hotlist format is invalid HTML,
* so this is a lie. */
- doc = htmlNewDoc("http://www.w3.org/TR/html4/strict.dtd",
- "-//W3C//DTD HTML 4.01//EN");
+ doc = htmlNewDoc(
+ (const xmlChar *) "http://www.w3.org/TR/html4/strict.dtd",
+ (const xmlChar *) "-//W3C//DTD HTML 4.01//EN");
if (!doc) {
warn_user("NoMemory", 0);
return false;
}
- html = xmlNewNode(NULL, "html");
+ html = xmlNewNode(NULL, (const xmlChar *) "html");
if (!html) {
warn_user("NoMemory", 0);
xmlFreeDoc(doc);
@@ -560,21 +561,22 @@ bool options_save_tree(struct tree *tree, const char *filename, const char *page
}
xmlDocSetRootElement(doc, html);
- head = xmlNewChild(html, NULL, "head", NULL);
+ head = xmlNewChild(html, NULL, (const xmlChar *) "head", NULL);
if (!head) {
warn_user("NoMemory", 0);
xmlFreeDoc(doc);
return false;
}
- title = xmlNewTextChild(head, NULL, "title", page_title);
+ title = xmlNewTextChild(head, NULL, (const xmlChar *) "title",
+ (const xmlChar *) page_title);
if (!title) {
warn_user("NoMemory", 0);
xmlFreeDoc(doc);
return false;
}
- body = xmlNewChild(html, NULL, "body", NULL);
+ body = xmlNewChild(html, NULL, (const xmlChar *) "body", NULL);
if (!body) {
warn_user("NoMemory", 0);
xmlFreeDoc(doc);
@@ -611,7 +613,7 @@ bool options_save_tree_directory(struct node *directory, xmlNode *node) {
struct node *child;
xmlNode *ul, *h4;
- ul = xmlNewChild(node, NULL, "ul", NULL);
+ ul = xmlNewChild(node, NULL, (const xmlChar *) "ul", NULL);
if (!ul)
return false;
@@ -623,7 +625,9 @@ bool options_save_tree_directory(struct node *directory, xmlNode *node) {
} else {
/* directory */
/* invalid HTML */
- h4 = xmlNewTextChild(ul, NULL, "h4", child->data.text);
+ h4 = xmlNewTextChild(ul, NULL,
+ (const xmlChar *) "h4",
+ (const xmlChar *) child->data.text);
if (!h4)
return false;
@@ -649,18 +653,20 @@ bool options_save_tree_entry(struct node *entry, xmlNode *node) {
xmlAttr *href;
struct node_element *element;
- li = xmlNewChild(node, NULL, "li", NULL);
+ li = xmlNewChild(node, NULL, (const xmlChar *) "li", NULL);
if (!li)
return false;
- a = xmlNewTextChild(li, NULL, "a", entry->data.text);
+ a = xmlNewTextChild(li, NULL, (const xmlChar *) "a",
+ (const xmlChar *) entry->data.text);
if (!a)
return false;
element = tree_find_element(entry, TREE_ELEMENT_URL);
if (!element)
return false;
- href = xmlNewProp(a, "href", element->text);
+ href = xmlNewProp(a, (const xmlChar *) "href",
+ (const xmlChar *) element->text);
if (!href)
return false;
return true;