1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00

Merge branch 'elinks-0.12' into elinks-0.13

Conflicts:
	src/session/download.c
This commit is contained in:
Kalle Olavi Niemitalo 2008-11-01 22:39:17 +02:00 committed by Kalle Olavi Niemitalo
commit 5c2fada371
61 changed files with 509 additions and 262 deletions

View File

@ -351,6 +351,10 @@ M. K. Srikant <srix@vsnl.com>
M. Levinson <levinsm@users.sourceforge.net>
Python scripting fixes
M. Vefa Bicakci <bicave@superonline.com>
Licenses modifications under "GPL version 2 or any later version."
Locale-independent case-insensitive comparisons
Malcolm Parsons <malcolm.parsons@gmail.com>
Typo fixes

3
NEWS
View File

@ -301,6 +301,9 @@ To be released as 0.11.6.
* critical bug 1053: fix crash if a download finishes after ELinks has
closed the terminal from which the download was started
* major bug 1004: ignore locales when comparing HTML element names and
similar strings, so e.g. ``title'' matches ``TITLE'' even in the
Turkish locale
ELinks 0.11.5:
--------------

View File

@ -556,7 +556,7 @@ test_search(struct listbox_item *item, void *data_, int *offset)
assert(ctx->title && ctx->url);
ctx->found = (*ctx->title && strcasestr(bm->title, ctx->title))
|| (*ctx->url && strcasestr(bm->url, ctx->url));
|| (*ctx->url && c_strcasestr(bm->url, ctx->url));
if (ctx->found) *offset = 0;
}

4
src/cache/dialogs.c vendored
View File

@ -193,8 +193,8 @@ match_cache_entry(struct listbox_item *item, struct terminal *term,
{
struct cache_entry *cached = item->udata;
if (strcasestr(struri(cached->uri), text)
|| (cached->head && strcasestr(cached->head, text)))
if (c_strcasestr(struri(cached->uri), text)
|| (cached->head && c_strcasestr(cached->head, text)))
return LISTBOX_MATCH_OK;
return LISTBOX_MATCH_NO;

View File

@ -321,7 +321,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
for (method = 0; remote_methods[method].name; method++) {
unsigned char *name = remote_methods[method].name;
if (!strlcasecmp(command, len, name, -1))
if (!c_strlcasecmp(command, len, name, -1))
break;
}
@ -359,7 +359,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
if (remote_argc < 1)
break;
if (!strcasecmp(remote_argv[0], "openBrowser")) {
if (!c_strcasecmp(remote_argv[0], "openBrowser")) {
remote_session_flags = SES_REMOTE_NEW_WINDOW;
}
break;
@ -450,7 +450,7 @@ print_full_help_inner(struct option *tree, unsigned char *path,
|| (option->flags & OPT_HIDDEN))
continue;
if (!capt && !strncasecmp(option->name, "_template_", 10))
if (!capt && !c_strncasecmp(option->name, "_template_", 10))
capt = (unsigned char *) N_("Template option folder");
if (!capt) {

View File

@ -18,6 +18,7 @@
#include "main/event.h"
#include "main/module.h"
#include "terminal/kbd.h"
#include "util/conv.h"
#include "util/memory.h"
#include "util/string.h"
@ -363,7 +364,7 @@ read_key(const unsigned char *key_str)
return key_str[0];
for (key = key_table; key->str; key++)
if (!strcasecmp(key->str, key_str))
if (!c_strcasecmp(key->str, key_str))
return key->num;
return KBD_UNDEF;
@ -380,17 +381,17 @@ parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
{
kbd->modifier = KBD_MOD_NONE;
while (1) {
if (!strncasecmp(s, "Shift", 5) && (s[5] == '-' || s[5] == '+')) {
if (!c_strncasecmp(s, "Shift", 5) && (s[5] == '-' || s[5] == '+')) {
/* Shift+a == shiFt-a == Shift-a */
kbd->modifier |= KBD_MOD_SHIFT;
s += 6;
} else if (!strncasecmp(s, "Ctrl", 4) && (s[4] == '-' || s[4] == '+')) {
} else if (!c_strncasecmp(s, "Ctrl", 4) && (s[4] == '-' || s[4] == '+')) {
/* Ctrl+a == ctRl-a == Ctrl-a */
kbd->modifier |= KBD_MOD_CTRL;
s += 5;
} else if (!strncasecmp(s, "Alt", 3) && (s[3] == '-' || s[3] == '+')) {
} else if (!c_strncasecmp(s, "Alt", 3) && (s[3] == '-' || s[3] == '+')) {
/* Alt+a == aLt-a == Alt-a */
kbd->modifier |= KBD_MOD_ALT;
s += 4;
@ -430,7 +431,7 @@ parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
* and instead make kbd_ev_lookup() or its callers
* search for different variants of the keystroke if
* the original one is not bound to any action. */
kbd->key = toupper(kbd->key);
kbd->key = c_toupper(kbd->key);
}
return (kbd->key == KBD_UNDEF) ? -1 : 0;

View File

@ -143,7 +143,7 @@ get_cookie_server(unsigned char *host, int hostlen)
/* XXX: We must count with cases like "x.co" vs "x.co.uk"
* below! */
int cslen = strlen(cs->host);
int cmp = strncasecmp(cs->host, host, hostlen);
int cmp = c_strncasecmp(cs->host, host, hostlen);
if (!sort_spot && (cmp > 0 || (cmp == 0 && cslen > hostlen))) {
/* This is the first @cs with name greater than @host,
@ -234,13 +234,13 @@ is_domain_security_ok(unsigned char *domain, unsigned char *server, int server_l
/* Match domain and server.. */
/* XXX: Hmm, can't we use strlcasecmp() here? --pasky */
/* XXX: Hmm, can't we use c_strlcasecmp() here? --pasky */
if (domain_len > server_len) return 0;
/* Ensure that the domain is atleast a substring of the server before
* continuing. */
if (strncasecmp(domain, server + server_len - domain_len, domain_len))
if (c_strncasecmp(domain, server + server_len - domain_len, domain_len))
return 0;
/* Allow domains which are same as servers. --<rono@sentuny.com.au> */
@ -499,8 +499,8 @@ accept_cookie(struct cookie *cookie)
struct cookie *c, *next;
foreachsafe (c, next, cookies) {
if (strcasecmp(c->name, cookie->name)
|| strcasecmp(c->domain, cookie->domain))
if (c_strcasecmp(c->name, cookie->name)
|| c_strcasecmp(c->domain, cookie->domain))
continue;
delete_cookie(c);
@ -513,7 +513,7 @@ accept_cookie(struct cookie *cookie)
/* XXX: This crunches CPU too. --pasky */
foreach (cd, c_domains)
if (!strcasecmp(cd->domain, cookie->domain))
if (!c_strcasecmp(cd->domain, cookie->domain))
return;
domain_len = strlen(cookie->domain);
@ -535,11 +535,11 @@ delete_cookie(struct cookie *c)
struct cookie *d;
foreach (d, cookies)
if (!strcasecmp(d->domain, c->domain))
if (!c_strcasecmp(d->domain, c->domain))
goto end;
foreach (cd, c_domains) {
if (!strcasecmp(cd->domain, c->domain)) {
if (!c_strcasecmp(cd->domain, c->domain)) {
del_from_list(cd);
mem_free(cd);
break;

View File

@ -287,7 +287,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
} else if (first_char == '!') {
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
if (!strncasecmp(string, "important", 9)) {
if (!c_strncasecmp(string, "important", 9)) {
type = CSS_TOKEN_IMPORTANT;
string += 9;
}

View File

@ -38,7 +38,7 @@ find_css_selector(struct css_selector_set *sels,
foreach_css_selector (selector, sels) {
if (type != selector->type || rel != selector->relation)
continue;
if (strlcasecmp(name, namelen, selector->name, -1))
if (c_strlcasecmp(name, namelen, selector->name, -1))
continue;
return selector;
}

View File

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

View File

@ -54,22 +54,22 @@ done_dom_renderer(struct dom_renderer *renderer)
static void
get_doctype(struct dom_renderer *renderer, struct cache_entry *cached)
{
if (!strcasecmp("application/rss+xml", cached->content_type)) {
if (!c_strcasecmp("application/rss+xml", cached->content_type)) {
renderer->doctype = SGML_DOCTYPE_RSS;
} else if (!strcasecmp("application/docbook+xml",
cached->content_type)) {
} else if (!c_strcasecmp("application/docbook+xml",
cached->content_type)) {
renderer->doctype = SGML_DOCTYPE_DOCBOOK;
} else if (!strcasecmp("application/xbel+xml", cached->content_type)
|| !strcasecmp("application/x-xbel", cached->content_type)
|| !strcasecmp("application/xbel", cached->content_type)) {
} else if (!c_strcasecmp("application/xbel+xml", cached->content_type)
|| !c_strcasecmp("application/x-xbel", cached->content_type)
|| !c_strcasecmp("application/xbel", cached->content_type)) {
renderer->doctype = SGML_DOCTYPE_XBEL;
} else {
assertm(!strcasecmp("text/html", cached->content_type)
|| !strcasecmp("application/xhtml+xml",
cached->content_type),
assertm(!c_strcasecmp("text/html", cached->content_type)
|| !c_strcasecmp("application/xhtml+xml",
cached->content_type),
"Couldn't resolve doctype '%s'", cached->content_type);
renderer->doctype = SGML_DOCTYPE_HTML;

View File

@ -137,7 +137,7 @@ find_fd(struct session *ses, unsigned char *name,
foreachback (doc_view, ses->scrn_frames) {
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->depth = depth;

View File

@ -94,7 +94,7 @@ get_target(struct document_options *options, unsigned char *a)
if (!v) return NULL;
if (!*v || !strcasecmp(v, "_self")) {
if (!*v || !c_strcasecmp(v, "_self")) {
mem_free_set(&v, stracpy(options->framename));
}
@ -341,7 +341,7 @@ search_for_url_param(unsigned char *str, unsigned char **ret)
/* Returns now if string @str is empty. */
if (!*str) return HEADER_PARAM_NOT_FOUND;
p = strcasestr(str, "url");
p = c_strcasestr(str, "url");
if (!p) return HEADER_PARAM_NOT_FOUND;
p += 3;
@ -551,7 +551,7 @@ look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri,
return 1;
}
if (strlcasecmp(name, namelen, "MAP", 3)) return 1;
if (c_strlcasecmp(name, namelen, "MAP", 3)) return 1;
if (uri && uri->fragment) {
/* FIXME (bug 784): options->cp is the terminal charset;
@ -559,7 +559,7 @@ look_for_map(unsigned char **pos, unsigned char *eof, struct uri *uri,
al = get_attr_val(attr, "name", options->cp);
if (!al) return 1;
if (strlcasecmp(al, -1, uri->fragment, uri->fragmentlen)) {
if (c_strlcasecmp(al, -1, uri->fragment, uri->fragmentlen)) {
mem_free(al);
return 1;
}
@ -606,12 +606,12 @@ look_for_tag(unsigned char **pos, unsigned char *eof,
if (parse_element(*pos, eof, NULL, NULL, NULL, &pos2)) return 1;
if (strlcasecmp(name, namelen, "A", 1)
&& strlcasecmp(name, namelen, "/A", 2)
&& strlcasecmp(name, namelen, "MAP", 3)
&& strlcasecmp(name, namelen, "/MAP", 4)
&& strlcasecmp(name, namelen, "AREA", 4)
&& strlcasecmp(name, namelen, "/AREA", 5)) {
if (c_strlcasecmp(name, namelen, "A", 1)
&& c_strlcasecmp(name, namelen, "/A", 2)
&& c_strlcasecmp(name, namelen, "MAP", 3)
&& c_strlcasecmp(name, namelen, "/MAP", 4)
&& c_strlcasecmp(name, namelen, "AREA", 4)
&& c_strlcasecmp(name, namelen, "/AREA", 5)) {
*pos = pos2;
return 1;
}
@ -648,12 +648,12 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu,
return 1;
}
if (!strlcasecmp(name, namelen, "A", 1)) {
if (!c_strlcasecmp(name, namelen, "A", 1)) {
while (look_for_tag(pos, eof, name, namelen, &label));
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;
* should use the document charset instead. */
unsigned char *alt = get_attr_val(attr, "alt", options->cp);
@ -667,7 +667,7 @@ look_for_link(unsigned char **pos, unsigned char *eof, struct menu_item **menu,
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! */
add_to_ml(ml, (void *) *menu, (void *) NULL);
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);
if (al) {
if (!strcasecmp(al, "post")) {
if (!c_strcasecmp(al, "post")) {
unsigned char *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;
if (enctype) {
if (!strcasecmp(enctype, "multipart/form-data"))
if (!c_strcasecmp(enctype, "multipart/form-data"))
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;
mem_free(enctype);
}
@ -153,11 +153,11 @@ html_button(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "type", cp);
if (!al) goto no_type_attr;
if (!strcasecmp(al, "button")) {
if (!c_strcasecmp(al, "button")) {
type = FC_BUTTON;
} else if (!strcasecmp(al, "reset")) {
} else if (!c_strcasecmp(al, "reset")) {
type = FC_RESET;
} else if (strcasecmp(al, "submit")) {
} else if (c_strcasecmp(al, "submit")) {
/* unknown type */
mem_free(al);
return;
@ -273,16 +273,16 @@ html_input(struct html_context *html_context, unsigned char *a,
al = get_attr_val(a, "type", cp);
if (al) {
if (!strcasecmp(al, "text")) fc->type = FC_TEXT;
else if (!strcasecmp(al, "hidden")) fc->type = FC_HIDDEN;
else if (!strcasecmp(al, "button")) fc->type = FC_BUTTON;
else if (!strcasecmp(al, "checkbox")) fc->type = FC_CHECKBOX;
else if (!strcasecmp(al, "radio")) fc->type = FC_RADIO;
else if (!strcasecmp(al, "password")) fc->type = FC_PASSWORD;
else if (!strcasecmp(al, "submit")) fc->type = FC_SUBMIT;
else if (!strcasecmp(al, "reset")) fc->type = FC_RESET;
else if (!strcasecmp(al, "file")) fc->type = FC_FILE;
else if (!strcasecmp(al, "image")) fc->type = FC_IMAGE;
if (!c_strcasecmp(al, "text")) fc->type = FC_TEXT;
else if (!c_strcasecmp(al, "hidden")) fc->type = FC_HIDDEN;
else if (!c_strcasecmp(al, "button")) fc->type = FC_BUTTON;
else if (!c_strcasecmp(al, "checkbox")) fc->type = FC_CHECKBOX;
else if (!c_strcasecmp(al, "radio")) fc->type = FC_RADIO;
else if (!c_strcasecmp(al, "password")) fc->type = FC_PASSWORD;
else if (!c_strcasecmp(al, "submit")) fc->type = FC_SUBMIT;
else if (!c_strcasecmp(al, "reset")) fc->type = FC_RESET;
else if (!c_strcasecmp(al, "file")) fc->type = FC_FILE;
else if (!c_strcasecmp(al, "image")) fc->type = FC_IMAGE;
/* else unknown type, let it default to FC_TEXT. */
mem_free(al);
}
@ -408,12 +408,12 @@ abort:
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);
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);
if (!closing_tag) {
@ -442,7 +442,7 @@ abort:
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);
if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0;
@ -586,10 +586,10 @@ sp:
if (namelen < 6) goto se;
if (name[0] == '/') name++, namelen--;
if (strlcasecmp(name, namelen, "OPTION", 6)
&& strlcasecmp(name, namelen, "SELECT", 6)
&& strlcasecmp(name, namelen, "OPTGROUP", 8))
if (c_strlcasecmp(name, namelen, "OPTION", 6)
&& c_strlcasecmp(name, namelen, "SELECT", 6)
&& c_strlcasecmp(name, namelen, "OPTGROUP", 8))
goto se;
}
@ -641,7 +641,7 @@ pp:
return;
}
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);
if (!fc) return;
@ -684,14 +684,14 @@ pp:
wrap_attr = get_attr_val(attr, "wrap", html_context->doc_cp);
if (wrap_attr) {
if (!strcasecmp(wrap_attr, "hard")
|| !strcasecmp(wrap_attr, "physical")) {
if (!c_strcasecmp(wrap_attr, "hard")
|| !c_strcasecmp(wrap_attr, "physical")) {
fc->wrap = FORM_WRAP_HARD;
} else if (!strcasecmp(wrap_attr, "soft")
|| !strcasecmp(wrap_attr, "virtual")) {
} else if (!c_strcasecmp(wrap_attr, "soft")
|| !c_strcasecmp(wrap_attr, "virtual")) {
fc->wrap = FORM_WRAP_SOFT;
} else if (!strcasecmp(wrap_attr, "none")
|| !strcasecmp(wrap_attr, "off")) {
} else if (!c_strcasecmp(wrap_attr, "none")
|| !c_strcasecmp(wrap_attr, "off")) {
fc->wrap = FORM_WRAP_NONE;
}
mem_free(wrap_attr);

View File

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

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);
if (!type) { mem_free(url); return; }
if (!strncasecmp(type, "text/", 5)) {
if (!c_strncasecmp(type, "text/", 5)) {
/* We will just emulate <iframe>. */
html_iframe_do(a, url, html_context);
html_skip(html_context, a);
} else if (!strncasecmp(type, "image/", 6)) {
} else if (!c_strncasecmp(type, "image/", 6)) {
/* <img> emulation. */
/* TODO: Use the enclosed text as 'alt' attribute. */
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;
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);
} else {
/* We will just emulate <iframe>. */
@ -757,26 +757,26 @@ html_link_parse(struct html_context *html_context, unsigned char *a,
/* TODO: fastfind */
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;
return 1;
}
if (strcasestr(link->name, "icon") ||
(link->content_type && strcasestr(link->content_type, "icon"))) {
if (c_strcasestr(link->name, "icon") ||
(link->content_type && c_strcasestr(link->content_type, "icon"))) {
link->type = LT_ICON;
} else if (strcasestr(link->name, "alternate")) {
} else if (c_strcasestr(link->name, "alternate")) {
link->type = LT_ALTERNATE;
if (link->lang)
link->type = LT_ALTERNATE_LANG;
else if (strcasestr(link->name, "stylesheet") ||
(link->content_type && strcasestr(link->content_type, "css")))
else if (c_strcasestr(link->name, "stylesheet") ||
(link->content_type && c_strcasestr(link->content_type, "css")))
link->type = LT_ALTERNATE_STYLESHEET;
else if (link->media)
link->type = LT_ALTERNATE_MEDIA;
} else if (link->content_type && strcasestr(link->content_type, "css")) {
} else if (link->content_type && c_strcasestr(link->content_type, "css")) {
link->type = LT_STYLESHEET;
}
@ -858,7 +858,7 @@ html_link(struct html_context *html_context, unsigned char *a,
if (link.lang && link.type == LT_ALTERNATE_LANG &&
(link_display < 3 || (link.hreflang &&
strcasecmp(link.hreflang, link.lang)))) {
c_strcasecmp(link.hreflang, link.lang)))) {
APPEND(link.lang);
}

View File

@ -153,7 +153,7 @@ next_attr:
n = name;
name_start = e;
while (atchr(*n) && atchr(*e) && toupper(*e) == toupper(*n)) e++, n++;
while (atchr(*n) && atchr(*e) && c_toupper(*e) == c_toupper(*n)) e++, n++;
found = !*n && !atchr(*e);
if (found && (flags & HTML_ATTR_TEST)) return name_start;
@ -506,8 +506,8 @@ static struct element_info elements[] = {
static int
compar(const void *a, const void *b)
{
return strcasecmp(((struct element_info *) a)->name,
((struct element_info *) b)->name);
return c_strcasecmp(((struct element_info *) a)->name,
((struct element_info *) b)->name);
}
#else
@ -550,7 +550,7 @@ void
init_tags_lookup(void)
{
#ifdef USE_FASTFIND
fastfind_index(&ff_tags_index, FF_COMPRESS);
fastfind_index(&ff_tags_index, FF_COMPRESS | FF_LOCALE_INDEP);
#endif
}
@ -907,11 +907,11 @@ start_element(struct element_info *ei,
foreach (e, html_context->stack) {
if (is_block_element(e) && is_inline_element(ei)) 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)
kill_html_stack_item(html_context, e->prev);
@ -1084,7 +1084,7 @@ end_element(struct element_info *ei,
* quotation). "she said." will be rendered normally. */
foreach (e, html_context->stack) {
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)
break;
else
@ -1183,10 +1183,10 @@ sp:
if (parse_element(s, eof, &name, &namelen, &attr, &s)) goto sp;
ps:
if (!strlcasecmp(name, namelen, "HEAD", 4)) goto se;
if (!strlcasecmp(name, namelen, "/HEAD", 5)) return;
if (!strlcasecmp(name, namelen, "BODY", 4)) return;
if (title && !title->length && !strlcasecmp(name, namelen, "TITLE", 5)) {
if (!c_strlcasecmp(name, namelen, "HEAD", 4)) goto se;
if (!c_strlcasecmp(name, namelen, "/HEAD", 5)) return;
if (!c_strlcasecmp(name, namelen, "BODY", 4)) return;
if (title && !title->length && !c_strlcasecmp(name, namelen, "TITLE", 5)) {
unsigned char *s1;
xse:
@ -1209,7 +1209,7 @@ xsp:
clr_spaces(title->source);
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;
* 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) {
if (element == html_top)
continue; /* skip the top element */
if (strlcasecmp(element->name, element->namelen, name, namelen))
if (c_strlcasecmp(element->name, element->namelen, name, namelen))
continue;
return element;
}
@ -218,7 +218,7 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
continue;
}
if (strlcasecmp(e->name, e->namelen, s, slen))
if (c_strlcasecmp(e->name, e->namelen, s, slen))
continue;
if (!sk) {
@ -240,11 +240,11 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
va_end(arg);
if (e->type < ELEMENT_KILLABLE
|| (!strlcasecmp(e->name, e->namelen, "TABLE", 5)))
|| (!c_strlcasecmp(e->name, e->namelen, "TABLE", 5)))
break;
if (e->namelen == 2 && toupper(e->name[0]) == 'T') {
unsigned char c = toupper(e->name[1]);
if (e->namelen == 2 && c_toupper(e->name[0]) == 'T') {
unsigned char c = c_toupper(e->name[1]);
if (c == 'D' || c == 'H' || c == 'R')
break;

View File

@ -89,11 +89,11 @@ get_align(struct html_context *html_context, unsigned char *attr, int *a)
if (!al) return;
if (!strcasecmp(al, "left")) *a = ALIGN_LEFT;
else if (!strcasecmp(al, "right")) *a = ALIGN_RIGHT;
else if (!strcasecmp(al, "center")) *a = ALIGN_CENTER;
else if (!strcasecmp(al, "justify")) *a = ALIGN_JUSTIFY;
else if (!strcasecmp(al, "char")) *a = ALIGN_RIGHT; /* NOT IMPLEMENTED */
if (!c_strcasecmp(al, "left")) *a = ALIGN_LEFT;
else if (!c_strcasecmp(al, "right")) *a = ALIGN_RIGHT;
else if (!c_strcasecmp(al, "center")) *a = ALIGN_CENTER;
else if (!c_strcasecmp(al, "justify")) *a = ALIGN_JUSTIFY;
else if (!c_strcasecmp(al, "char")) *a = ALIGN_RIGHT; /* NOT IMPLEMENTED */
mem_free(al);
}
@ -104,10 +104,10 @@ get_valign(struct html_context *html_context, unsigned char *attr, int *a)
if (!al) return;
if (!strcasecmp(al, "top")) *a = VALIGN_TOP;
else if (!strcasecmp(al, "middle")) *a = VALIGN_MIDDLE;
else if (!strcasecmp(al, "bottom")) *a = VALIGN_BOTTOM;
else if (!strcasecmp(al, "baseline")) *a = VALIGN_BASELINE; /* NOT IMPLEMENTED */
if (!c_strcasecmp(al, "top")) *a = VALIGN_TOP;
else if (!c_strcasecmp(al, "middle")) *a = VALIGN_MIDDLE;
else if (!c_strcasecmp(al, "bottom")) *a = VALIGN_BOTTOM;
else if (!c_strcasecmp(al, "baseline")) *a = VALIGN_BASELINE; /* NOT IMPLEMENTED */
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);
if (!al) return;
if (!strcasecmp(al, "void")) table->frame = TABLE_FRAME_VOID;
else if (!strcasecmp(al, "above")) table->frame = TABLE_FRAME_ABOVE;
else if (!strcasecmp(al, "below")) table->frame = TABLE_FRAME_BELOW;
else if (!strcasecmp(al, "hsides")) table->frame = TABLE_FRAME_HSIDES;
else if (!strcasecmp(al, "vsides")) table->frame = TABLE_FRAME_VSIDES;
else if (!strcasecmp(al, "lhs")) table->frame = TABLE_FRAME_LHS;
else if (!strcasecmp(al, "rhs")) table->frame = TABLE_FRAME_RHS;
if (!c_strcasecmp(al, "void")) table->frame = TABLE_FRAME_VOID;
else if (!c_strcasecmp(al, "above")) table->frame = TABLE_FRAME_ABOVE;
else if (!c_strcasecmp(al, "below")) table->frame = TABLE_FRAME_BELOW;
else if (!c_strcasecmp(al, "hsides")) table->frame = TABLE_FRAME_HSIDES;
else if (!c_strcasecmp(al, "vsides")) table->frame = TABLE_FRAME_VSIDES;
else if (!c_strcasecmp(al, "lhs")) table->frame = TABLE_FRAME_LHS;
else if (!c_strcasecmp(al, "rhs")) table->frame = TABLE_FRAME_RHS;
/* Following tests are useless since TABLE_FRAME_BOX is the default.
* else if (!strcasecmp(al, "box")) table->frame = TABLE_FRAME_BOX;
* else if (!strcasecmp(al, "border")) table->frame = TABLE_FRAME_BOX;
* else if (!c_strcasecmp(al, "box")) table->frame = TABLE_FRAME_BOX;
* else if (!c_strcasecmp(al, "border")) table->frame = TABLE_FRAME_BOX;
*/
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);
if (!al) return;
if (!strcasecmp(al, "none")) table->rules = TABLE_RULE_NONE;
else if (!strcasecmp(al, "groups")) table->rules = TABLE_RULE_GROUPS;
else if (!strcasecmp(al, "rows")) table->rules = TABLE_RULE_ROWS;
else if (!strcasecmp(al, "cols")) table->rules = TABLE_RULE_COLS;
else if (!strcasecmp(al, "all")) table->rules = TABLE_RULE_ALL;
if (!c_strcasecmp(al, "none")) table->rules = TABLE_RULE_NONE;
else if (!c_strcasecmp(al, "groups")) table->rules = TABLE_RULE_GROUPS;
else if (!c_strcasecmp(al, "rows")) table->rules = TABLE_RULE_ROWS;
else if (!c_strcasecmp(al, "cols")) table->rules = TABLE_RULE_COLS;
else if (!c_strcasecmp(al, "all")) table->rules = TABLE_RULE_ALL;
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) {
level++;
} else {
@ -608,7 +608,7 @@ see:
closing_tag = 0;
}
if (!strlcasecmp(name, namelen, "TABLE", 5)) {
if (!c_strlcasecmp(name, namelen, "TABLE", 5)) {
if (!closing_tag) {
en = skip_table(en, eof);
goto see;
@ -623,7 +623,7 @@ see:
}
}
if (!strlcasecmp(name, namelen, "CAPTION", 7)) {
if (!c_strlcasecmp(name, namelen, "CAPTION", 7)) {
if (!closing_tag) {
add_table_bad_html_end(table, html);
if (!table->caption.start)
@ -637,7 +637,7 @@ 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);
add_table_bad_html_end(table, html);
@ -663,7 +663,7 @@ 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;
add_table_bad_html_end(table, html);
@ -684,12 +684,12 @@ see:
}
/* All following tags have T as first letter. */
if (toupper(name[0]) != 'T') goto see;
if (c_toupper(name[0]) != 'T') goto see;
name++; namelen--;
if (namelen == 0) goto see;
c = toupper(name[0]);
c = c_toupper(name[0]);
/* /TR /TD /TH */
if (closing_tag && namelen == 1) {
@ -712,9 +712,9 @@ see:
/* THEAD TBODY TFOOT */
if (namelen == 4
&& ((!strlcasecmp(name, namelen, "HEAD", 4)) ||
(!strlcasecmp(name, namelen, "BODY", 4)) ||
(!strlcasecmp(name, namelen, "FOOT", 4)))) {
&& ((!c_strlcasecmp(name, namelen, "HEAD", 4)) ||
(!c_strlcasecmp(name, namelen, "BODY", 4)) ||
(!c_strlcasecmp(name, namelen, "FOOT", 4)))) {
if (c_span) new_columns(table, c_span, c_width, c_al, c_val, 1);
add_table_bad_html_end(table, html);

View File

@ -1389,7 +1389,7 @@ new_link(struct html_context *html_context, unsigned char *name, int namelen)
if (!format.form) {
link->target = null_or_stracpy(format.target);
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
&& ((format.link[0]|32) == 'm')
&& ((format.link[1]|32) == 'a')

View File

@ -96,7 +96,7 @@ int
compare_opt(struct document_options *o1, struct document_options *o2)
{
return memcmp(o1, o2, offsetof(struct document_options, framename))
|| strcasecmp(o1->framename, o2->framename)
|| c_strcasecmp(o1->framename, o2->framename)
|| (o1->box.x != o2->box.x)
|| (o1->box.y != o2->box.y)
|| ((o1->needs_height || o2->needs_height)

View File

@ -244,13 +244,13 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
if (document->options.plain) {
#ifdef CONFIG_DOM
if (cached->content_type
&& (!strcasecmp("text/html", cached->content_type)
|| !strcasecmp("application/xhtml+xml", cached->content_type)
|| !strcasecmp("application/docbook+xml", cached->content_type)
|| !strcasecmp("application/rss+xml", cached->content_type)
|| !strcasecmp("application/xbel+xml", cached->content_type)
|| !strcasecmp("application/x-xbel", cached->content_type)
|| !strcasecmp("application/xbel", cached->content_type)))
&& (!c_strcasecmp("text/html", cached->content_type)
|| !c_strcasecmp("application/xhtml+xml", cached->content_type)
|| !c_strcasecmp("application/docbook+xml", cached->content_type)
|| !c_strcasecmp("application/rss+xml", cached->content_type)
|| !c_strcasecmp("application/xbel+xml", cached->content_type)
|| !c_strcasecmp("application/x-xbel", cached->content_type)
|| !c_strcasecmp("application/xbel", cached->content_type)))
render_dom_document(cached, document, &buffer);
else
#endif
@ -259,7 +259,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
} else {
#ifdef CONFIG_DOM
if (cached->content_type
&& (!strlcasecmp("application/rss+xml", 19, cached->content_type, -1)))
&& (!c_strlcasecmp("application/rss+xml", 19, cached->content_type, -1)))
render_dom_document(cached, document, &buffer);
else
#endif

View File

@ -290,7 +290,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token)
} else if (first_char == '!') {
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
if (!strncasecmp(string, "important", 9)) {
if (!c_strncasecmp(string, "important", 9)) {
type = CSS_TOKEN_IMPORTANT;
string += 9;
}

View File

@ -35,7 +35,7 @@ struct dom_scanner_token {
/** Compare the token string to a "static" string */
#define dom_scanner_token_contains(token, str) \
((token)->string.length == (sizeof(str) - 1) \
&& !strncasecmp((token)->string.string, str, sizeof(str) - 1))
&& !c_strncasecmp((token)->string.string, str, sizeof(str) - 1))
struct dom_scan_table_info {

View File

@ -1,6 +1,7 @@
#ifndef EL_DOM_STRING_H
#define EL_DOM_STRING_H
#include "util/conv.h"
#include "util/memory.h"
/* For now DOM has it's own little string library. Mostly because there are
@ -31,9 +32,9 @@ static inline int
dom_string_casecmp(const struct dom_string *string1, const struct dom_string *string2)
{
size_t length = int_min(string1->length, string2->length);
size_t string_diff = strncasecmp(string1->string, string2->string, length);
size_t string_diff = c_strncasecmp(string1->string, string2->string, length);
/* If the lengths or strings don't match strncasecmp() does the
/* If the lengths or strings don't match c_strncasecmp() does the
* job else return which ever is bigger. */
return string_diff ? string_diff : string1->length - string2->length;
}
@ -41,7 +42,7 @@ dom_string_casecmp(const struct dom_string *string1, const struct dom_string *st
static inline int
dom_string_ncasecmp(struct dom_string *string1, struct dom_string *string2, size_t length)
{
return strncasecmp(string1->string, string2->string, length);
return c_strncasecmp(string1->string, string2->string, length);
}
#define copy_dom_string(string1, string2) \

View File

@ -153,7 +153,7 @@ document_get(struct SEE_interpreter *interp, struct SEE_object *o,
if (!string) return;
foreach (form, document->forms) {
if (!form->name || strcasecmp(string, form->name))
if (!form->name || c_strcasecmp(string, form->name))
continue;
form_view = find_form_view(doc_view, form);
form_object = js_get_form_object(interp, doc, form_view);

View File

@ -689,7 +689,7 @@ js_form_elems_namedItem(struct SEE_interpreter *interp, struct SEE_object *self,
return;
foreach (fc, form->items) {
if ((fc->id && !strcasecmp(string, fc->id)) || (fc->name && !strcasecmp(string, fc->name))) {
if ((fc->id && !c_strcasecmp(string, fc->id)) || (fc->name && !c_strcasecmp(string, fc->name))) {
struct form_state *fs = find_form_state(doc_view, fc);
if (fs) {
@ -815,7 +815,7 @@ js_forms_namedItem(struct SEE_interpreter *interp, struct SEE_object *self,
if (!string)
return;
foreach (form, document->forms) {
if (form->name && !strcasecmp(string, form->name)) {
if (form->name && !c_strcasecmp(string, form->name)) {
struct form_view *fv = find_form_view(doc_view, form);
struct js_form *obj = js_get_form_object(interp,
doc, fv);