summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box_construct.c77
-rw-r--r--render/html.c48
-rw-r--r--render/imagemap.c16
-rw-r--r--render/textplain.c2
4 files changed, 77 insertions, 66 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index b5c04be3b..741816ac8 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -355,7 +355,7 @@ bool box_construct_element(xmlNode *n, struct content *content,
/* extract title attribute, if present */
if ((title0 = xmlGetProp(n, (const xmlChar *) "title"))) {
- char *title1 = squash_whitespace(title0);
+ char *title1 = squash_whitespace((char *) title0);
xmlFree(title0);
if (!title1)
return false;
@@ -638,7 +638,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
if (parent_style->white_space == CSS_WHITE_SPACE_NORMAL ||
parent_style->white_space == CSS_WHITE_SPACE_NOWRAP) {
- char *text = squash_whitespace(n->content);
+ char *text = squash_whitespace((char *) n->content);
if (!text)
return false;
@@ -719,7 +719,7 @@ bool box_construct_text(xmlNode *n, struct content *content,
} else {
/* white-space: pre */
- char *text = cnv_space2nbsp(n->content);
+ char *text = cnv_space2nbsp((char *) n->content);
char *current;
/* note: pre-wrap/pre-line are unimplemented */
assert(parent_style->white_space == CSS_WHITE_SPACE_PRE ||
@@ -823,14 +823,14 @@ struct css_style * box_get_style(struct content *c,
colour border_color = 0x888888; /* mid-grey default for tables */
/* if not in a table, switch off cellpadding and cell borders */
- if (strcmp(n->name, "thead") != 0 &&
- strcmp(n->name, "tbody") != 0 &&
- strcmp(n->name, "tfoot") != 0 &&
- strcmp(n->name, "tr") != 0 &&
- strcmp(n->name, "td") != 0 &&
- strcmp(n->name, "th") != 0 &&
- strcmp(n->name, "col") != 0 &&
- strcmp(n->name, "colgroup") != 0) {
+ if (strcmp((const char *) n->name, "thead") != 0 &&
+ strcmp((const char *) n->name, "tbody") != 0 &&
+ strcmp((const char *) n->name, "tfoot") != 0 &&
+ strcmp((const char *) n->name, "tr") != 0 &&
+ strcmp((const char *) n->name, "td") != 0 &&
+ strcmp((const char *) n->name, "th") != 0 &&
+ strcmp((const char *) n->name, "col") != 0 &&
+ strcmp((const char *) n->name, "colgroup") != 0) {
markup_track->cell_border = false;
markup_track->cell_padding = false;
}
@@ -1205,17 +1205,17 @@ struct css_style * box_get_style(struct content *c,
* text-align for the current block can be handled in the default
* CSS file.
*/
- if (strcmp(n->name, "center") == 0)
+ if (strcmp((const char *) n->name, "center") == 0)
markup_track->align = ALIGN_CENTER;
- else if (strcmp(n->name, "div") == 0 ||
- strcmp(n->name, "col") == 0 ||
- strcmp(n->name, "colgroup") == 0 ||
- strcmp(n->name, "tbody") == 0 ||
- strcmp(n->name, "td") == 0 ||
- strcmp(n->name, "tfoot") == 0 ||
- strcmp(n->name, "th") == 0 ||
- strcmp(n->name, "thead") == 0 ||
- strcmp(n->name, "tr") == 0) {
+ else if (strcmp((const char *) n->name, "div") == 0 ||
+ strcmp((const char *) n->name, "col") == 0 ||
+ strcmp((const char *) n->name, "colgroup") == 0 ||
+ strcmp((const char *) n->name, "tbody") == 0 ||
+ strcmp((const char *) n->name, "td") == 0 ||
+ strcmp((const char *) n->name, "tfoot") == 0 ||
+ strcmp((const char *) n->name, "th") == 0 ||
+ strcmp((const char *) n->name, "thead") == 0 ||
+ strcmp((const char *) n->name, "tr") == 0) {
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "align"))) {
if (strcasecmp(s, "center") == 0)
@@ -1229,13 +1229,13 @@ struct css_style * box_get_style(struct content *c,
}
/* Table cells without an align value have a default implied
* alignment */
- if (strcmp(n->name, "td") == 0) {
+ if (strcmp((const char *) n->name, "td") == 0) {
if (!(s = (char *) xmlGetProp(n, (const xmlChar *) "align")))
markup_track->align = ALIGN_LEFT;
else
xmlFree(s);
}
- if (strcmp(n->name, "th") == 0) {
+ if (strcmp((const char *) n->name, "th") == 0) {
if (!(s = (char *) xmlGetProp(n, (const xmlChar *) "align")))
markup_track->align = ALIGN_CENTER;
else
@@ -1336,19 +1336,20 @@ void box_text_transform(char *s, unsigned int len,
switch (tt) {
case CSS_TEXT_TRANSFORM_UPPERCASE:
for (i = 0; i < len; ++i)
- if (s[i] < 0x80)
+ if ((unsigned char) s[i] < 0x80)
s[i] = toupper(s[i]);
break;
case CSS_TEXT_TRANSFORM_LOWERCASE:
for (i = 0; i < len; ++i)
- if (s[i] < 0x80)
+ if ((unsigned char) s[i] < 0x80)
s[i] = tolower(s[i]);
break;
case CSS_TEXT_TRANSFORM_CAPITALIZE:
- if (s[0] < 0x80)
+ if ((unsigned char) s[0] < 0x80)
s[0] = toupper(s[0]);
for (i = 1; i < len; ++i)
- if (s[i] < 0x80 && isspace(s[i - 1]))
+ if ((unsigned char) s[i] < 0x80 &&
+ isspace(s[i - 1]))
s[i] = toupper(s[i]);
break;
default:
@@ -1437,19 +1438,19 @@ bool box_a(BOX_SPECIAL_PARAMS)
/* target frame [16.3] */
if ((s = xmlGetProp(n, (const xmlChar *) "target"))) {
- if (!strcasecmp(s, "_blank"))
+ if (!strcasecmp((const char *) s, "_blank"))
box->target = TARGET_BLANK;
- else if (!strcasecmp(s, "_top"))
+ else if (!strcasecmp((const char *) s, "_top"))
box->target = TARGET_TOP;
- else if (!strcasecmp(s, "_parent"))
+ else if (!strcasecmp((const char *) s, "_parent"))
box->target = TARGET_PARENT;
- else if (!strcasecmp(s, "_self"))
+ else if (!strcasecmp((const char *) s, "_self"))
/* the default may have been overridden by a
* <base target=...>, so this is different to 0 */
box->target = TARGET_SELF;
else if (('a' <= s[0] && s[0] <= 'z') ||
('A' <= s[0] && s[0] <= 'Z')) { /* [6.16] */
- box->target = talloc_strdup(content, s);
+ box->target = talloc_strdup(content, (const char *) s);
if (!box->target) {
xmlFree(s);
return false;
@@ -1477,7 +1478,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
/* handle alt text */
if ((alt = xmlGetProp(n, (const xmlChar *) "alt"))) {
- s = squash_whitespace(alt);
+ s = squash_whitespace((const char *) alt);
xmlFree(alt);
if (!s)
return false;
@@ -2589,12 +2590,12 @@ bool box_select_add_option(struct form_control *control, xmlNode *n)
char *text_nowrap = 0;
bool selected;
xmlChar *content;
- xmlChar *s;
+ char *s;
content = xmlNodeGetContent(n);
if (!content)
goto no_memory;
- text = squash_whitespace(content);
+ text = squash_whitespace((const char *) content);
xmlFree(content);
if (!text)
goto no_memory;
@@ -2703,8 +2704,8 @@ bool box_textarea(BOX_SPECIAL_PARAMS)
while (1) {
/* BOX_TEXT */
- len = strcspn(current, "\r\n");
- s = talloc_strndup(content, current, len);
+ len = strcspn((const char *) current, "\r\n");
+ s = talloc_strndup(content, (const char *) current, len);
if (!s) {
xmlFree(string);
xmlBufferFree(buf);
@@ -2849,7 +2850,7 @@ bool box_get_attribute(xmlNode *n, const char *attribute,
xmlChar *s = xmlGetProp(n, (const xmlChar *) attribute);
if (!s)
return true;
- *value = talloc_strdup(context, s);
+ *value = talloc_strdup(context, (const char *) s);
xmlFree(s);
if (!*value)
return false;
diff --git a/render/html.c b/render/html.c
index c54f23ea8..0c55bd805 100644
--- a/render/html.c
+++ b/render/html.c
@@ -203,16 +203,19 @@ bool html_process_data(struct content *c, char *data, unsigned int size)
/* However, if that encoding is non-ASCII-compatible,
* ignore it, as it can't possibly be correct */
- if (strncasecmp(c->data.html.parser->input->encoding,
+ if (strncasecmp((const char *) c->data.html.parser->
+ input->encoding,
"UTF-16", 6) == 0 || /* UTF-16(LE|BE)? */
- strncasecmp(c->data.html.parser->input->encoding,
+ strncasecmp((const char *) c->data.html.parser->
+ input->encoding,
"UTF-32", 6) == 0) { /* UTF-32(LE|BE)? */
c->data.html.encoding = talloc_strdup(c, "ISO-8859-1");
c->data.html.encoding_source =
ENCODING_SOURCE_DETECTED;
} else {
c->data.html.encoding = talloc_strdup(c,
- c->data.html.parser->input->encoding);
+ (const char *) c->data.html.parser->
+ input->encoding);
c->data.html.encoding_source = ENCODING_SOURCE_META;
}
@@ -523,11 +526,12 @@ bool html_head(struct content *c, xmlNode *head)
continue;
LOG(("Node: %s", node->name));
- if (!c->title && strcmp(node->name, "title") == 0) {
+ if (!c->title && strcmp((const char *) node->name,
+ "title") == 0) {
xmlChar *title = xmlNodeGetContent(node);
if (!title)
return false;
- char *title2 = squash_whitespace(title);
+ char *title2 = squash_whitespace((const char *) title);
xmlFree(title);
if (!title2)
return false;
@@ -536,7 +540,7 @@ bool html_head(struct content *c, xmlNode *head)
if (!c->title)
return false;
- } else if (strcmp(node->name, "base") == 0) {
+ } else if (strcmp((const char *) node->name, "base") == 0) {
char *href = (char *) xmlGetProp(node,
(const xmlChar *) "href");
if (href) {
@@ -552,12 +556,18 @@ bool html_head(struct content *c, xmlNode *head)
}
/* don't use the central values to ease freeing later on */
if ((s = xmlGetProp(node, (const xmlChar *) "target"))) {
- if ((!strcasecmp(s, "_blank")) || (!strcasecmp(s, "_top")) ||
- (!strcasecmp(s, "_parent")) ||
- (!strcasecmp(s, "_self")) ||
+ if ((!strcasecmp((const char *) s, "_blank")) ||
+ (!strcasecmp((const char *) s,
+ "_top")) ||
+ (!strcasecmp((const char *) s,
+ "_parent")) ||
+ (!strcasecmp((const char *) s,
+ "_self")) ||
('a' <= s[0] && s[0] <= 'z') ||
('A' <= s[0] && s[0] <= 'Z')) { /* [6.16] */
- c->data.html.base_target = talloc_strdup(c, s);
+ c->data.html.base_target =
+ talloc_strdup(c,
+ (const char *) s);
if (!c->data.html.base_target) {
xmlFree(s);
return false;
@@ -594,7 +604,7 @@ bool html_meta_refresh(struct content *c, xmlNode *head)
continue;
/* Recurse into noscript elements */
- if (strcmp((const char *)n->name, "noscript") == 0) {
+ if (strcmp((const char *) n->name, "noscript") == 0) {
if (!html_meta_refresh(c, n)) {
/* Some error occurred */
return false;
@@ -604,26 +614,26 @@ bool html_meta_refresh(struct content *c, xmlNode *head)
}
}
- if (strcmp((const char *)n->name, "meta")) {
+ if (strcmp((const char *) n->name, "meta")) {
continue;
}
- equiv = xmlGetProp(n, (const xmlChar *)"http-equiv");
+ equiv = xmlGetProp(n, (const xmlChar *) "http-equiv");
if (!equiv)
continue;
- if (strcasecmp((const char *)equiv, "refresh")) {
+ if (strcasecmp((const char *) equiv, "refresh")) {
xmlFree(equiv);
continue;
}
xmlFree(equiv);
- content = xmlGetProp(n, (const xmlChar *)"content");
+ content = xmlGetProp(n, (const xmlChar *) "content");
if (!content)
continue;
- end = (char *)content + strlen(content);
+ end = (char *) content + strlen((const char *) content);
msg_data.delay = (int)strtol((char *) content, &url, 10);
/* a very small delay and self-referencing URL can cause a loop
@@ -776,7 +786,7 @@ bool html_find_stylesheets(struct content *c, xmlNode *html,
if (node->type != XML_ELEMENT_NODE)
continue;
- if (strcmp(node->name, "link") != 0)
+ if (strcmp((const char *) node->name, "link") != 0)
continue;
/* rel=<space separated list, including 'stylesheet'> */
@@ -949,7 +959,7 @@ bool html_find_inline_stylesheets(struct content *c, xmlNode *html)
if (node->type != XML_ELEMENT_NODE)
continue;
- if (strcmp(node->name, "style") != 0)
+ if (strcmp((const char *) node->name, "style") != 0)
continue;
if (!html_process_style_element(c, node))
@@ -1012,7 +1022,7 @@ bool html_process_style_element(struct content *c, xmlNode *style)
* give the content of comments which may be used to 'hide'
* the content */
for (child = style->children; child != 0; child = child->next) {
- data = xmlNodeGetContent(child);
+ data = (char *) xmlNodeGetContent(child);
if (!content_process_data(c->data.html.
stylesheet_content[STYLESHEET_STYLE],
data, strlen(data))) {
diff --git a/render/imagemap.c b/render/imagemap.c
index 399cd6225..852af6213 100644
--- a/render/imagemap.c
+++ b/render/imagemap.c
@@ -247,11 +247,11 @@ bool imagemap_extract(xmlNode *node, struct content *c)
assert(c != NULL);
if (node->type == XML_ELEMENT_NODE) {
- if (strcmp(node->name, "map") == 0) {
- if ((name = (char *)xmlGetProp(node,
- (const xmlChar *)"id")) == NULL) {
- if ((name = (char *)xmlGetProp(node,
- (const xmlChar *)"name")) ==
+ if (strcmp((const char *) node->name, "map") == 0) {
+ if ((name = (char *) xmlGetProp(node,
+ (const xmlChar *) "id")) == NULL) {
+ if ((name = (char *) xmlGetProp(node,
+ (const xmlChar *) "name")) ==
NULL)
return true;
}
@@ -306,8 +306,8 @@ bool imagemap_extract_map(xmlNode *node, struct content *c,
/** \todo ignore <area> elements if there are other
* block-level elements present in map
*/
- if (strcmp(node->name, "area") == 0 ||
- strcmp(node->name, "a") == 0) {
+ if (strcmp((const char *) node->name, "area") == 0 ||
+ strcmp((const char *) node->name, "a") == 0) {
return imagemap_addtolist(node,
c->data.html.base_url, entry);
}
@@ -341,7 +341,7 @@ bool imagemap_addtolist(xmlNode *n, char *base_url, struct mapentry **entry)
assert(base_url != NULL);
assert(entry != NULL);
- if (strcmp(n->name, "area") == 0) {
+ if (strcmp((const char *) n->name, "area") == 0) {
/* nohref attribute present - ignore this entry */
if (xmlGetProp(n, (const xmlChar*)"nohref") != 0) {
return true;
diff --git a/render/textplain.c b/render/textplain.c
index c096c97a2..63610ba17 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -503,7 +503,7 @@ size_t textplain_offset_from_coords(struct content *c, int x, int y, int dir)
if (x <= width) {
int pixel_offset;
- int char_offset;
+ size_t char_offset;
nsfont_position_in_string(&textplain_style,
text, next_offset, x,