1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Patch 1: Finalize modifications to the HTML parser

[Forward ported to 0.12 from bug 1004 attachment 498.  --KON]
This commit is contained in:
M. Vefa Bicakci 2008-10-19 03:25:00 +02:00 committed by Kalle Olavi Niemitalo
parent 85c26ddc45
commit 86085de07e
10 changed files with 108 additions and 108 deletions

View File

@ -187,7 +187,7 @@ find_tag(struct document *document, unsigned char *name, int namelen)
struct tag *tag; struct tag *tag;
foreach (tag, document->tags) foreach (tag, document->tags)
if (!strlcasecmp(tag->name, -1, name, namelen)) if (!c_strlcasecmp(tag->name, -1, name, namelen))
return tag->y; return tag->y;
return -1; return -1;

View File

@ -137,7 +137,7 @@ find_fd(struct session *ses, unsigned char *name,
foreachback (doc_view, ses->scrn_frames) { foreachback (doc_view, ses->scrn_frames) {
if (doc_view->used) continue; if (doc_view->used) continue;
if (strcasecmp(doc_view->name, name)) continue; if (c_strcasecmp(doc_view->name, name)) continue;
doc_view->used = 1; doc_view->used = 1;
doc_view->depth = depth; doc_view->depth = depth;

View File

@ -88,7 +88,7 @@ get_target(struct document_options *options, unsigned char *a)
if (!v) return NULL; if (!v) return NULL;
if (!*v || !strcasecmp(v, "_self")) { if (!*v || !c_strcasecmp(v, "_self")) {
mem_free_set(&v, stracpy(options->framename)); mem_free_set(&v, stracpy(options->framename));
} }
@ -547,7 +547,7 @@ look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri,
return 1; return 1;
} }
if (strlcasecmp(name, namelen, "MAP", 3)) return 1; if (c_strlcasecmp(name, namelen, "MAP", 3)) return 1;
if (uri && uri->fragment) { if (uri && uri->fragment) {
/* FIXME (bug 784): options->cp is the terminal charset; /* FIXME (bug 784): options->cp is the terminal charset;
@ -555,7 +555,7 @@ look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri,
al = get_attr_val(attr, "name", options->cp); al = get_attr_val(attr, "name", options->cp);
if (!al) return 1; if (!al) return 1;
if (strlcasecmp(al, -1, uri->fragment, uri->fragmentlen)) { if (c_strlcasecmp(al, -1, uri->fragment, uri->fragmentlen)) {
mem_free(al); mem_free(al);
return 1; return 1;
} }
@ -602,12 +602,12 @@ look_for_tag(unsigned char **pos, unsigned char *eof,
if (parse_element(*pos, eof, NULL, NULL, NULL, &pos2)) return 1; if (parse_element(*pos, eof, NULL, NULL, NULL, &pos2)) return 1;
if (strlcasecmp(name, namelen, "A", 1) if (c_strlcasecmp(name, namelen, "A", 1)
&& strlcasecmp(name, namelen, "/A", 2) && c_strlcasecmp(name, namelen, "/A", 2)
&& strlcasecmp(name, namelen, "MAP", 3) && c_strlcasecmp(name, namelen, "MAP", 3)
&& strlcasecmp(name, namelen, "/MAP", 4) && c_strlcasecmp(name, namelen, "/MAP", 4)
&& strlcasecmp(name, namelen, "AREA", 4) && c_strlcasecmp(name, namelen, "AREA", 4)
&& strlcasecmp(name, namelen, "/AREA", 5)) { && c_strlcasecmp(name, namelen, "/AREA", 5)) {
*pos = pos2; *pos = pos2;
return 1; return 1;
} }
@ -644,12 +644,12 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu,
return 1; return 1;
} }
if (!strlcasecmp(name, namelen, "A", 1)) { if (!c_strlcasecmp(name, namelen, "A", 1)) {
while (look_for_tag(pos, eof, name, namelen, &label)); while (look_for_tag(pos, eof, name, namelen, &label));
if (*pos >= eof) return 0; if (*pos >= eof) return 0;
} else if (!strlcasecmp(name, namelen, "AREA", 4)) { } else if (!c_strlcasecmp(name, namelen, "AREA", 4)) {
/* FIXME (bug 784): options->cp is the terminal charset; /* FIXME (bug 784): options->cp is the terminal charset;
* should use the document charset instead. */ * should use the document charset instead. */
unsigned char *alt = get_attr_val(attr, "alt", options->cp); unsigned char *alt = get_attr_val(attr, "alt", options->cp);
@ -663,7 +663,7 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu,
label = NULL; label = NULL;
} }
} else if (!strlcasecmp(name, namelen, "/MAP", 4)) { } else if (!c_strlcasecmp(name, namelen, "/MAP", 4)) {
/* This is the only successful return from here! */ /* This is the only successful return from here! */
add_to_ml(ml, (void *) *menu, (void *) NULL); add_to_ml(ml, (void *) *menu, (void *) NULL);
return 0; return 0;

View File

@ -52,7 +52,7 @@ html_form(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "method", html_context->doc_cp); al = get_attr_val(a, "method", html_context->doc_cp);
if (al) { if (al) {
if (!strcasecmp(al, "post")) { if (!c_strcasecmp(al, "post")) {
unsigned char *enctype; unsigned char *enctype;
enctype = get_attr_val(a, "enctype", enctype = get_attr_val(a, "enctype",
@ -60,9 +60,9 @@ html_form(struct html_context *html_context, unsigned char *a,
form->method = FORM_METHOD_POST; form->method = FORM_METHOD_POST;
if (enctype) { if (enctype) {
if (!strcasecmp(enctype, "multipart/form-data")) if (!c_strcasecmp(enctype, "multipart/form-data"))
form->method = FORM_METHOD_POST_MP; form->method = FORM_METHOD_POST_MP;
else if (!strcasecmp(enctype, "text/plain")) else if (!c_strcasecmp(enctype, "text/plain"))
form->method = FORM_METHOD_POST_TEXT_PLAIN; form->method = FORM_METHOD_POST_TEXT_PLAIN;
mem_free(enctype); mem_free(enctype);
} }
@ -153,11 +153,11 @@ html_button(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "type", cp); al = get_attr_val(a, "type", cp);
if (!al) goto no_type_attr; if (!al) goto no_type_attr;
if (!strcasecmp(al, "button")) { if (!c_strcasecmp(al, "button")) {
type = FC_BUTTON; type = FC_BUTTON;
} else if (!strcasecmp(al, "reset")) { } else if (!c_strcasecmp(al, "reset")) {
type = FC_RESET; type = FC_RESET;
} else if (strcasecmp(al, "submit")) { } else if (c_strcasecmp(al, "submit")) {
/* unknown type */ /* unknown type */
mem_free(al); mem_free(al);
return; return;
@ -273,16 +273,16 @@ html_input(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "type", cp); al = get_attr_val(a, "type", cp);
if (al) { if (al) {
if (!strcasecmp(al, "text")) fc->type = FC_TEXT; if (!c_strcasecmp(al, "text")) fc->type = FC_TEXT;
else if (!strcasecmp(al, "hidden")) fc->type = FC_HIDDEN; else if (!c_strcasecmp(al, "hidden")) fc->type = FC_HIDDEN;
else if (!strcasecmp(al, "button")) fc->type = FC_BUTTON; else if (!c_strcasecmp(al, "button")) fc->type = FC_BUTTON;
else if (!strcasecmp(al, "checkbox")) fc->type = FC_CHECKBOX; else if (!c_strcasecmp(al, "checkbox")) fc->type = FC_CHECKBOX;
else if (!strcasecmp(al, "radio")) fc->type = FC_RADIO; else if (!c_strcasecmp(al, "radio")) fc->type = FC_RADIO;
else if (!strcasecmp(al, "password")) fc->type = FC_PASSWORD; else if (!c_strcasecmp(al, "password")) fc->type = FC_PASSWORD;
else if (!strcasecmp(al, "submit")) fc->type = FC_SUBMIT; else if (!c_strcasecmp(al, "submit")) fc->type = FC_SUBMIT;
else if (!strcasecmp(al, "reset")) fc->type = FC_RESET; else if (!c_strcasecmp(al, "reset")) fc->type = FC_RESET;
else if (!strcasecmp(al, "file")) fc->type = FC_FILE; else if (!c_strcasecmp(al, "file")) fc->type = FC_FILE;
else if (!strcasecmp(al, "image")) fc->type = FC_IMAGE; else if (!c_strcasecmp(al, "image")) fc->type = FC_IMAGE;
/* else unknown type, let it default to FC_TEXT. */ /* else unknown type, let it default to FC_TEXT. */
mem_free(al); mem_free(al);
} }
@ -408,12 +408,12 @@ abort:
closing_tag = 0; closing_tag = 0;
} }
if (closing_tag && !strlcasecmp(name, namelen, "SELECT", 6)) { if (closing_tag && !c_strlcasecmp(name, namelen, "SELECT", 6)) {
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
goto end_parse; goto end_parse;
} }
if (!strlcasecmp(name, namelen, "OPTION", 6)) { if (!c_strlcasecmp(name, namelen, "OPTION", 6)) {
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
if (!closing_tag) { if (!closing_tag) {
@ -442,7 +442,7 @@ abort:
goto see; goto see;
} }
if (!strlcasecmp(name, namelen, "OPTGROUP", 8)) { if (!c_strlcasecmp(name, namelen, "OPTGROUP", 8)) {
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0; if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0;
@ -587,9 +587,9 @@ sp:
if (namelen < 6) goto se; if (namelen < 6) goto se;
if (name[0] == '/') name++, namelen--; if (name[0] == '/') name++, namelen--;
if (strlcasecmp(name, namelen, "OPTION", 6) if (c_strlcasecmp(name, namelen, "OPTION", 6)
&& strlcasecmp(name, namelen, "SELECT", 6) && c_strlcasecmp(name, namelen, "SELECT", 6)
&& strlcasecmp(name, namelen, "OPTGROUP", 8)) && c_strlcasecmp(name, namelen, "OPTGROUP", 8))
goto se; goto se;
} }
@ -641,7 +641,7 @@ pp:
return; return;
} }
if (parse_element(p, eof, &t_name, &t_namelen, NULL, end)) goto pp; if (parse_element(p, eof, &t_name, &t_namelen, NULL, end)) goto pp;
if (strlcasecmp(t_name, t_namelen, "/TEXTAREA", 9)) goto pp; if (c_strlcasecmp(t_name, t_namelen, "/TEXTAREA", 9)) goto pp;
fc = init_form_control(FC_TEXTAREA, attr, html_context); fc = init_form_control(FC_TEXTAREA, attr, html_context);
if (!fc) return; if (!fc) return;
@ -684,14 +684,14 @@ pp:
wrap_attr = get_attr_val(attr, "wrap", html_context->doc_cp); wrap_attr = get_attr_val(attr, "wrap", html_context->doc_cp);
if (wrap_attr) { if (wrap_attr) {
if (!strcasecmp(wrap_attr, "hard") if (!c_strcasecmp(wrap_attr, "hard")
|| !strcasecmp(wrap_attr, "physical")) { || !c_strcasecmp(wrap_attr, "physical")) {
fc->wrap = FORM_WRAP_HARD; fc->wrap = FORM_WRAP_HARD;
} else if (!strcasecmp(wrap_attr, "soft") } else if (!c_strcasecmp(wrap_attr, "soft")
|| !strcasecmp(wrap_attr, "virtual")) { || !c_strcasecmp(wrap_attr, "virtual")) {
fc->wrap = FORM_WRAP_SOFT; fc->wrap = FORM_WRAP_SOFT;
} else if (!strcasecmp(wrap_attr, "none") } else if (!c_strcasecmp(wrap_attr, "none")
|| !strcasecmp(wrap_attr, "off")) { || !c_strcasecmp(wrap_attr, "off")) {
fc->wrap = FORM_WRAP_NONE; fc->wrap = FORM_WRAP_NONE;
} }
mem_free(wrap_attr); mem_free(wrap_attr);

View File

@ -227,10 +227,10 @@ html_script(struct html_context *html_context, unsigned char *a,
if (type) { if (type) {
unsigned char *pos = type; unsigned char *pos = type;
if (!strncasecmp(type, "text/", 5)) { if (!c_strncasecmp(type, "text/", 5)) {
pos += 5; pos += 5;
} else if (!strncasecmp(type, "application/", 12)) { } else if (!c_strncasecmp(type, "application/", 12)) {
pos += 12; pos += 12;
} else { } else {
@ -241,7 +241,7 @@ not_processed:
return; return;
} }
if (!strncasecmp(pos, "javascript", 10)) { if (!c_strncasecmp(pos, "javascript", 10)) {
int len = strlen(pos); int len = strlen(pos);
if (len > 10 && !isdigit(pos[10])) { if (len > 10 && !isdigit(pos[10])) {
@ -249,11 +249,11 @@ not_processed:
goto not_processed; goto not_processed;
} }
} else if (strcasecmp(pos, "ecmascript") } else if (c_strcasecmp(pos, "ecmascript")
&& strcasecmp(pos, "jscript") && c_strcasecmp(pos, "jscript")
&& strcasecmp(pos, "livescript") && c_strcasecmp(pos, "livescript")
&& strcasecmp(pos, "x-javascript") && c_strcasecmp(pos, "x-javascript")
&& strcasecmp(pos, "x-ecmascript")) { && c_strcasecmp(pos, "x-ecmascript")) {
mem_free(type); mem_free(type);
goto not_processed; goto not_processed;
} }
@ -271,7 +271,7 @@ not_processed:
if (languagelen < 10 if (languagelen < 10
|| (languagelen > 10 && !isdigit(language[10])) || (languagelen > 10 && !isdigit(language[10]))
|| strncasecmp(language, "javascript", 10)) { || c_strncasecmp(language, "javascript", 10)) {
mem_free(language); mem_free(language);
goto not_processed; goto not_processed;
} }
@ -372,7 +372,7 @@ imported:
* argument. */ * argument. */
if (parse_element(*end, eof, &name, &namelen, NULL, NULL)) if (parse_element(*end, eof, &name, &namelen, NULL, NULL))
continue; continue;
if (strlcasecmp(name, namelen, "/script", 7)) if (c_strlcasecmp(name, namelen, "/script", 7))
continue; continue;
/* We have won! */ /* We have won! */
break; break;
@ -482,13 +482,13 @@ html_linebrk(struct html_context *html_context, unsigned char *a,
unsigned char *al = get_attr_val(a, "align", html_context->doc_cp); unsigned char *al = get_attr_val(a, "align", html_context->doc_cp);
if (al) { if (al) {
if (!strcasecmp(al, "left")) par_format.align = ALIGN_LEFT; if (!c_strcasecmp(al, "left")) par_format.align = ALIGN_LEFT;
else if (!strcasecmp(al, "right")) par_format.align = ALIGN_RIGHT; else if (!c_strcasecmp(al, "right")) par_format.align = ALIGN_RIGHT;
else if (!strcasecmp(al, "center")) { else if (!c_strcasecmp(al, "center")) {
par_format.align = ALIGN_CENTER; par_format.align = ALIGN_CENTER;
if (!html_context->table_level) if (!html_context->table_level)
par_format.leftmargin = par_format.rightmargin = 0; par_format.leftmargin = par_format.rightmargin = 0;
} else if (!strcasecmp(al, "justify")) par_format.align = ALIGN_JUSTIFY; } else if (!c_strcasecmp(al, "justify")) par_format.align = ALIGN_JUSTIFY;
mem_free(al); mem_free(al);
} }
} }
@ -745,9 +745,9 @@ html_ul(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "type", html_context->doc_cp); al = get_attr_val(a, "type", html_context->doc_cp);
if (al) { if (al) {
if (!strcasecmp(al, "disc") || !strcasecmp(al, "circle")) if (!c_strcasecmp(al, "disc") || !c_strcasecmp(al, "circle"))
par_format.flags = P_O; par_format.flags = P_O;
else if (!strcasecmp(al, "square")) else if (!c_strcasecmp(al, "square"))
par_format.flags = P_PLUS; par_format.flags = P_PLUS;
mem_free(al); mem_free(al);
} }

View File

@ -463,12 +463,12 @@ html_object(struct html_context *html_context, unsigned char *a,
type = get_attr_val(a, "type", html_context->doc_cp); type = get_attr_val(a, "type", html_context->doc_cp);
if (!type) { mem_free(url); return; } if (!type) { mem_free(url); return; }
if (!strncasecmp(type, "text/", 5)) { if (!c_strncasecmp(type, "text/", 5)) {
/* We will just emulate <iframe>. */ /* We will just emulate <iframe>. */
html_iframe_do(a, url, html_context); html_iframe_do(a, url, html_context);
html_skip(html_context, a); html_skip(html_context, a);
} else if (!strncasecmp(type, "image/", 6)) { } else if (!c_strncasecmp(type, "image/", 6)) {
/* <img> emulation. */ /* <img> emulation. */
/* TODO: Use the enclosed text as 'alt' attribute. */ /* TODO: Use the enclosed text as 'alt' attribute. */
html_img_do(a, url, html_context); html_img_do(a, url, html_context);
@ -519,7 +519,7 @@ html_embed(struct html_context *html_context, unsigned char *a,
if (!extension) extension = object_src; if (!extension) extension = object_src;
type = get_extension_content_type(extension); type = get_extension_content_type(extension);
if (type && !strncasecmp(type, "image/", 6)) { if (type && !c_strncasecmp(type, "image/", 6)) {
html_img_do(a, object_src, html_context); html_img_do(a, object_src, html_context);
} else { } else {
/* We will just emulate <iframe>. */ /* We will just emulate <iframe>. */
@ -757,7 +757,7 @@ html_link_parse(struct html_context *html_context, unsigned char *a,
/* TODO: fastfind */ /* TODO: fastfind */
for (i = 0; lt_names[i].str; i++) for (i = 0; lt_names[i].str; i++)
if (!strcasecmp(link->name, lt_names[i].str)) { if (!c_strcasecmp(link->name, lt_names[i].str)) {
link->type = lt_names[i].type; link->type = lt_names[i].type;
return 1; return 1;
} }
@ -857,7 +857,7 @@ html_link(struct html_context *html_context, unsigned char *a,
if (link.lang && link.type == LT_ALTERNATE_LANG && if (link.lang && link.type == LT_ALTERNATE_LANG &&
(link_display < 3 || (link.hreflang && (link_display < 3 || (link.hreflang &&
strcasecmp(link.hreflang, link.lang)))) { c_strcasecmp(link.hreflang, link.lang)))) {
APPEND(link.lang); APPEND(link.lang);
} }

View File

@ -863,11 +863,11 @@ start_element(struct element_info *ei,
foreach (e, html_context->stack) { foreach (e, html_context->stack) {
if (is_block_element(e) && is_inline_element(ei)) break; if (is_block_element(e) && is_inline_element(ei)) break;
if (e->type < ELEMENT_KILLABLE) break; if (e->type < ELEMENT_KILLABLE) break;
if (!strlcasecmp(e->name, e->namelen, name, namelen)) break; if (!c_strlcasecmp(e->name, e->namelen, name, namelen)) break;
} }
} }
if (!strlcasecmp(e->name, e->namelen, name, namelen)) { if (!c_strlcasecmp(e->name, e->namelen, name, namelen)) {
while (e->prev != (void *) &html_context->stack) while (e->prev != (void *) &html_context->stack)
kill_html_stack_item(html_context, e->prev); kill_html_stack_item(html_context, e->prev);
@ -972,7 +972,7 @@ end_element(struct element_info *ei,
/* dump_html_stack(html_context); */ /* dump_html_stack(html_context); */
foreach (e, html_context->stack) { foreach (e, html_context->stack) {
if (is_block_element(e) && is_inline_element(ei)) kill = 1; if (is_block_element(e) && is_inline_element(ei)) kill = 1;
if (strlcasecmp(e->name, e->namelen, name, namelen)) { if (c_strlcasecmp(e->name, e->namelen, name, namelen)) {
if (e->type < ELEMENT_KILLABLE) if (e->type < ELEMENT_KILLABLE)
break; break;
else else
@ -1070,10 +1070,10 @@ sp:
if (parse_element(s, eof, &name, &namelen, &attr, &s)) goto sp; if (parse_element(s, eof, &name, &namelen, &attr, &s)) goto sp;
ps: ps:
if (!strlcasecmp(name, namelen, "HEAD", 4)) goto se; if (!c_strlcasecmp(name, namelen, "HEAD", 4)) goto se;
if (!strlcasecmp(name, namelen, "/HEAD", 5)) return; if (!c_strlcasecmp(name, namelen, "/HEAD", 5)) return;
if (!strlcasecmp(name, namelen, "BODY", 4)) return; if (!c_strlcasecmp(name, namelen, "BODY", 4)) return;
if (title && !title->length && !strlcasecmp(name, namelen, "TITLE", 5)) { if (title && !title->length && !c_strlcasecmp(name, namelen, "TITLE", 5)) {
unsigned char *s1; unsigned char *s1;
xse: xse:
@ -1096,7 +1096,7 @@ xsp:
clr_spaces(title->source); clr_spaces(title->source);
goto ps; goto ps;
} }
if (strlcasecmp(name, namelen, "META", 4)) goto se; if (c_strlcasecmp(name, namelen, "META", 4)) goto se;
/* FIXME (bug 784): options->cp is the terminal charset; /* FIXME (bug 784): options->cp is the terminal charset;
* should use the document charset instead. */ * should use the document charset instead. */

View File

@ -62,7 +62,7 @@ search_html_stack(struct html_context *html_context, unsigned char *name)
foreach (element, html_context->stack) { foreach (element, html_context->stack) {
if (element == html_top) if (element == html_top)
continue; /* skip the top element */ continue; /* skip the top element */
if (strlcasecmp(element->name, element->namelen, name, namelen)) if (c_strlcasecmp(element->name, element->namelen, name, namelen))
continue; continue;
return element; return element;
} }
@ -218,7 +218,7 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
continue; continue;
} }
if (strlcasecmp(e->name, e->namelen, s, slen)) if (c_strlcasecmp(e->name, e->namelen, s, slen))
continue; continue;
if (!sk) { if (!sk) {
@ -240,7 +240,7 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
va_end(arg); va_end(arg);
if (e->type < ELEMENT_KILLABLE if (e->type < ELEMENT_KILLABLE
|| (!strlcasecmp(e->name, e->namelen, "TABLE", 5))) || (!c_strlcasecmp(e->name, e->namelen, "TABLE", 5)))
break; break;
if (e->namelen == 2 && toupper(e->name[0]) == 'T') { if (e->namelen == 2 && toupper(e->name[0]) == 'T') {

View File

@ -89,11 +89,11 @@ get_align(struct html_context *html_context, unsigned char *attr, int *a)
if (!al) return; if (!al) return;
if (!strcasecmp(al, "left")) *a = ALIGN_LEFT; if (!c_strcasecmp(al, "left")) *a = ALIGN_LEFT;
else if (!strcasecmp(al, "right")) *a = ALIGN_RIGHT; else if (!c_strcasecmp(al, "right")) *a = ALIGN_RIGHT;
else if (!strcasecmp(al, "center")) *a = ALIGN_CENTER; else if (!c_strcasecmp(al, "center")) *a = ALIGN_CENTER;
else if (!strcasecmp(al, "justify")) *a = ALIGN_JUSTIFY; else if (!c_strcasecmp(al, "justify")) *a = ALIGN_JUSTIFY;
else if (!strcasecmp(al, "char")) *a = ALIGN_RIGHT; /* NOT IMPLEMENTED */ else if (!c_strcasecmp(al, "char")) *a = ALIGN_RIGHT; /* NOT IMPLEMENTED */
mem_free(al); mem_free(al);
} }
@ -104,10 +104,10 @@ get_valign(struct html_context *html_context, unsigned char *attr, int *a)
if (!al) return; if (!al) return;
if (!strcasecmp(al, "top")) *a = VALIGN_TOP; if (!c_strcasecmp(al, "top")) *a = VALIGN_TOP;
else if (!strcasecmp(al, "middle")) *a = VALIGN_MIDDLE; else if (!c_strcasecmp(al, "middle")) *a = VALIGN_MIDDLE;
else if (!strcasecmp(al, "bottom")) *a = VALIGN_BOTTOM; else if (!c_strcasecmp(al, "bottom")) *a = VALIGN_BOTTOM;
else if (!strcasecmp(al, "baseline")) *a = VALIGN_BASELINE; /* NOT IMPLEMENTED */ else if (!c_strcasecmp(al, "baseline")) *a = VALIGN_BASELINE; /* NOT IMPLEMENTED */
mem_free(al); mem_free(al);
} }
@ -154,16 +154,16 @@ set_table_frame(struct html_context *html_context, struct table *table,
al = get_attr_val(attr, "frame", html_context->doc_cp); al = get_attr_val(attr, "frame", html_context->doc_cp);
if (!al) return; if (!al) return;
if (!strcasecmp(al, "void")) table->frame = TABLE_FRAME_VOID; if (!c_strcasecmp(al, "void")) table->frame = TABLE_FRAME_VOID;
else if (!strcasecmp(al, "above")) table->frame = TABLE_FRAME_ABOVE; else if (!c_strcasecmp(al, "above")) table->frame = TABLE_FRAME_ABOVE;
else if (!strcasecmp(al, "below")) table->frame = TABLE_FRAME_BELOW; else if (!c_strcasecmp(al, "below")) table->frame = TABLE_FRAME_BELOW;
else if (!strcasecmp(al, "hsides")) table->frame = TABLE_FRAME_HSIDES; else if (!c_strcasecmp(al, "hsides")) table->frame = TABLE_FRAME_HSIDES;
else if (!strcasecmp(al, "vsides")) table->frame = TABLE_FRAME_VSIDES; else if (!c_strcasecmp(al, "vsides")) table->frame = TABLE_FRAME_VSIDES;
else if (!strcasecmp(al, "lhs")) table->frame = TABLE_FRAME_LHS; else if (!c_strcasecmp(al, "lhs")) table->frame = TABLE_FRAME_LHS;
else if (!strcasecmp(al, "rhs")) table->frame = TABLE_FRAME_RHS; else if (!c_strcasecmp(al, "rhs")) table->frame = TABLE_FRAME_RHS;
/* Following tests are useless since TABLE_FRAME_BOX is the default. /* Following tests are useless since TABLE_FRAME_BOX is the default.
* else if (!strcasecmp(al, "box")) table->frame = TABLE_FRAME_BOX; * else if (!c_strcasecmp(al, "box")) table->frame = TABLE_FRAME_BOX;
* else if (!strcasecmp(al, "border")) table->frame = TABLE_FRAME_BOX; * else if (!c_strcasecmp(al, "border")) table->frame = TABLE_FRAME_BOX;
*/ */
mem_free(al); mem_free(al);
} }
@ -179,11 +179,11 @@ set_table_rules(struct html_context *html_context, struct table *table,
al = get_attr_val(attr, "rules", html_context->doc_cp); al = get_attr_val(attr, "rules", html_context->doc_cp);
if (!al) return; if (!al) return;
if (!strcasecmp(al, "none")) table->rules = TABLE_RULE_NONE; if (!c_strcasecmp(al, "none")) table->rules = TABLE_RULE_NONE;
else if (!strcasecmp(al, "groups")) table->rules = TABLE_RULE_GROUPS; else if (!c_strcasecmp(al, "groups")) table->rules = TABLE_RULE_GROUPS;
else if (!strcasecmp(al, "rows")) table->rules = TABLE_RULE_ROWS; else if (!c_strcasecmp(al, "rows")) table->rules = TABLE_RULE_ROWS;
else if (!strcasecmp(al, "cols")) table->rules = TABLE_RULE_COLS; else if (!c_strcasecmp(al, "cols")) table->rules = TABLE_RULE_COLS;
else if (!strcasecmp(al, "all")) table->rules = TABLE_RULE_ALL; else if (!c_strcasecmp(al, "all")) table->rules = TABLE_RULE_ALL;
mem_free(al); mem_free(al);
} }
@ -527,7 +527,7 @@ skip_table(unsigned char *html, unsigned char *eof)
} }
if (!strlcasecmp(name, namelen, "TABLE", 5)) { if (!c_strlcasecmp(name, namelen, "TABLE", 5)) {
if (!closing_tag) { if (!closing_tag) {
level++; level++;
} else { } else {
@ -608,7 +608,7 @@ see:
closing_tag = 0; closing_tag = 0;
} }
if (!strlcasecmp(name, namelen, "TABLE", 5)) { if (!c_strlcasecmp(name, namelen, "TABLE", 5)) {
if (!closing_tag) { if (!closing_tag) {
en = skip_table(en, eof); en = skip_table(en, eof);
goto see; goto see;
@ -623,7 +623,7 @@ see:
} }
} }
if (!strlcasecmp(name, namelen, "CAPTION", 7)) { if (!c_strlcasecmp(name, namelen, "CAPTION", 7)) {
if (!closing_tag) { if (!closing_tag) {
add_table_bad_html_end(table, html); add_table_bad_html_end(table, html);
if (!table->caption.start) if (!table->caption.start)
@ -637,7 +637,7 @@ see:
goto see; goto see;
} }
if (!strlcasecmp(name, namelen, "COLGROUP", 8)) { if (!c_strlcasecmp(name, namelen, "COLGROUP", 8)) {
if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1); if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1);
add_table_bad_html_end(table, html); add_table_bad_html_end(table, html);
@ -663,7 +663,7 @@ see:
goto see; goto see;
} }
if (!closing_tag && !strlcasecmp(name, namelen, "COL", 3)) { if (!closing_tag && !c_strlcasecmp(name, namelen, "COL", 3)) {
int sp, width, al, val; int sp, width, al, val;
add_table_bad_html_end(table, html); add_table_bad_html_end(table, html);
@ -712,9 +712,9 @@ see:
/* THEAD TBODY TFOOT */ /* THEAD TBODY TFOOT */
if (namelen == 4 if (namelen == 4
&& ((!strlcasecmp(name, namelen, "HEAD", 4)) || && ((!c_strlcasecmp(name, namelen, "HEAD", 4)) ||
(!strlcasecmp(name, namelen, "BODY", 4)) || (!c_strlcasecmp(name, namelen, "BODY", 4)) ||
(!strlcasecmp(name, namelen, "FOOT", 4)))) { (!c_strlcasecmp(name, namelen, "FOOT", 4)))) {
if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1); if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1);
add_table_bad_html_end(table, html); add_table_bad_html_end(table, html);

View File

@ -1251,7 +1251,7 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen)
if (!format.form) { if (!format.form) {
link->target = null_or_stracpy(format.target); link->target = null_or_stracpy(format.target);
link->data.name = memacpy(name, namelen); link->data.name = memacpy(name, namelen);
/* if (strlen(url) > 4 && !strncasecmp(url, "MAP@", 4)) { */ /* if (strlen(url) > 4 && !c_strncasecmp(url, "MAP@", 4)) { */
if (format.link if (format.link
&& ((format.link[0]|32) == 'm') && ((format.link[0]|32) == 'm')
&& ((format.link[1]|32) == 'a') && ((format.link[1]|32) == 'a')