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

Patch 2: Modifications to the remaining parts of ELinks

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

View File

@ -319,7 +319,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;
}
@ -357,7 +357,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;
@ -448,7 +448,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

@ -363,7 +363,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;
@ -377,17 +377,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;

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> */
@ -498,8 +498,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);
@ -512,7 +512,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);
@ -534,11 +534,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(LIST_OF(struct css_selector) *sels,
foreach (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

@ -993,22 +993,22 @@ static struct dom_stack_context_info dom_rss_renderer_context_info = {
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

@ -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

@ -243,8 +243,8 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
|| (!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

@ -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) {

View File

@ -95,7 +95,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

@ -243,13 +243,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
@ -258,7 +258,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

@ -31,9 +31,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 +41,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

@ -126,7 +126,7 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
}
#endif
foreach (form, document->forms) {
if (!form->name || strcasecmp(string, form->name))
if (!form->name || c_strcasecmp(string, form->name))
continue;
object_to_jsval(ctx, vp, get_form_object(ctx, obj, find_form_view(doc_view, form)));

View File

@ -857,7 +857,8 @@ form_elements_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
undef_to_jsval(ctx, rval);
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) {
@ -979,7 +980,8 @@ form_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
JSObject *fcobj = NULL;
struct form_state *fs;
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)))
continue;
undef_to_jsval(ctx, vp);
@ -1120,21 +1122,21 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
case JSP_FORM_ENCODING:
string = jsval_to_string(ctx, vp);
if (!strcasecmp(string, "application/x-www-form-urlencoded")) {
if (!c_strcasecmp(string, "application/x-www-form-urlencoded")) {
form->method = form->method == FORM_METHOD_GET ? FORM_METHOD_GET
: FORM_METHOD_POST;
} else if (!strcasecmp(string, "multipart/form-data")) {
} else if (!c_strcasecmp(string, "multipart/form-data")) {
form->method = FORM_METHOD_POST_MP;
} else if (!strcasecmp(string, "text/plain")) {
} else if (!c_strcasecmp(string, "text/plain")) {
form->method = FORM_METHOD_POST_TEXT_PLAIN;
}
break;
case JSP_FORM_METHOD:
string = jsval_to_string(ctx, vp);
if (!strcasecmp(string, "GET")) {
if (!c_strcasecmp(string, "GET")) {
form->method = FORM_METHOD_GET;
} else if (!strcasecmp(string, "POST")) {
} else if (!c_strcasecmp(string, "POST")) {
form->method = FORM_METHOD_POST;
}
break;
@ -1353,7 +1355,7 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc,
return;
foreach (form, doc_view->document->forms) {
if (form->name && !strcasecmp(string, form->name)) {
if (form->name && !c_strcasecmp(string, form->name)) {
object_to_jsval(ctx, rval, get_form_object(ctx, jsdoc,
find_form_view(doc_view, form)));
break;

View File

@ -399,7 +399,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
return JS_TRUE;
}
if (frame && *frame && strcasecmp(frame, "_blank")) {
if (frame && *frame && c_strcasecmp(frame, "_blank")) {
struct delayed_open *deo = mem_calloc(1, sizeof(*deo));
if (deo) {

View File

@ -1313,7 +1313,7 @@ get_cp_index(const unsigned char *name)
int i, a;
int syscp = 0;
if (!strcasecmp(name, "System")) {
if (!c_strcasecmp(name, "System")) {
#if HAVE_LANGINFO_CODESET
name = nl_langinfo(CODESET);
syscp = SYSTEM_CHARSET_FLAG;
@ -1336,7 +1336,7 @@ get_cp_index(const unsigned char *name)
* once. So we will do a simple strcasecmp() here.
*/
if (!strcasecmp(name, codepages[i].aliases[a]))
if (!c_strcasecmp(name, codepages[i].aliases[a]))
return i | syscp;
}
}
@ -1394,7 +1394,7 @@ get_cp_index(const unsigned char *name)
const struct codepage_desc *codepage;
int syscp = 0;
if (!strcasecmp(name, "System")) {
if (!c_strcasecmp(name, "System")) {
#if HAVE_LANGINFO_CODESET
name = nl_langinfo(CODESET);
syscp = SYSTEM_CHARSET_FLAG;

View File

@ -349,7 +349,7 @@ _nl_normalize_codeset(const unsigned char *codeset, size_t name_len)
for (cnt = 0; cnt < name_len; ++cnt)
if (isalpha(codeset[cnt]))
*wp++ = tolower(codeset[cnt]);
*wp++ = c_tolower(codeset[cnt]);
else if (isdigit(codeset[cnt]))
*wp++ = codeset[cnt];

View File

@ -152,7 +152,7 @@ name_to_language(const unsigned char *name)
int i;
for (i = 0; languages[i].name; i++) {
if (strcasecmp(languages[i].name, name))
if (c_strcasecmp(languages[i].name, name))
continue;
return i;
}

View File

@ -285,5 +285,5 @@ extend_alias_table(void)
static int
alias_compare(const struct alias_map *map1, const struct alias_map *map2)
{
return strcasecmp(map1->alias, map2->alias);
return c_strcasecmp(map1->alias, map2->alias);
}

View File

@ -280,13 +280,13 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
if (!field) break;
if (!strncasecmp(field, "needsterminal", 13)) {
if (!c_strncasecmp(field, "needsterminal", 13)) {
entry->needsterminal = 1;
} else if (!strncasecmp(field, "copiousoutput", 13)) {
} else if (!c_strncasecmp(field, "copiousoutput", 13)) {
entry->copiousoutput = 1;
} else if (!strncasecmp(field, "test", 4)) {
} else if (!c_strncasecmp(field, "test", 4)) {
entry->testcommand = get_mailcap_field_text(field + 4);
if (!entry->testcommand)
return 0;
@ -298,7 +298,7 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
return 0;
}
} else if (!strncasecmp(field, "description", 11)) {
} else if (!c_strncasecmp(field, "description", 11)) {
entry->description = get_mailcap_field_text(field + 11);
if (!entry->description)
return 0;

View File

@ -89,7 +89,7 @@ find_in_dns_cache(unsigned char *name)
struct dnsentry *dnsentry;
foreach (dnsentry, dns_cache)
if (!strcasecmp(dnsentry->name, name)) {
if (!c_strcasecmp(dnsentry->name, name)) {
move_to_top_of_list(dns_cache, dnsentry);
return dnsentry;
}

View File

@ -297,7 +297,7 @@ auth_user_matching_uri(struct auth_entry *auth, struct uri *uri)
{
if (!uri->userlen) /* Noone said it doesn't. */
return 1;
return !strlcasecmp(auth->user, -1, uri->user, uri->userlen);
return !c_strlcasecmp(auth->user, -1, uri->user, uri->userlen);
}
@ -898,7 +898,7 @@ next:
if (pos + 4 > data_len)
return -1;
if (strncasecmp(&data[pos], "byte", 4))
if (c_strncasecmp(&data[pos], "byte", 4))
return -1;
errno = 0;

View File

@ -224,7 +224,7 @@ add_gopher_command(struct connection *conn, struct string *command,
querylen = selector + selectorlen - query;
/* Exclude '?' */
selectorlen -= querylen + 1;
if (querylen >= 7 && !strncasecmp(query, "search=", 7)) {
if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) {
query += 7;
querylen -= 7;
}

View File

@ -133,7 +133,7 @@ parse_header(unsigned char *head, unsigned char *item, unsigned char **ptr)
/* Does item match header line ? */
for (itempos = item; *itempos && *pos; itempos++, pos++)
if (toupper(*itempos) != toupper(*pos))
if (c_toupper(*itempos) != c_toupper(*pos))
break;
if (!*pos) break; /* Nothing left to parse. */
@ -226,7 +226,7 @@ parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret)
while (*p && (*p == ';' || *p <= ' ')) p++;
if (strlen(p) < namelen) return HEADER_PARAM_NOT_FOUND;
} while (strncasecmp(p, name, namelen));
} while (c_strncasecmp(p, name, namelen));
p += namelen;
@ -275,11 +275,11 @@ get_header_param(unsigned char *e, unsigned char *name)
unsigned char *n, *start;
again:
while (*e && toupper(*e++) != toupper(*name));
while (*e && c_toupper(*e++) != c_toupper(*name));
if (!*e) return NULL;
n = name + 1;
while (*n && toupper(*e) == toupper(*n)) e++, n++;
while (*n && c_toupper(*e) == c_toupper(*n)) e++, n++;
if (*n) goto again;
skip_space(e);

View File

@ -34,7 +34,7 @@ get_blacklist_entry(struct uri *uri)
if_assert_failed return NULL;
foreach (entry, blacklist)
if (!strlcasecmp(entry->host, -1, uri->host, uri->hostlen))
if (!c_strlcasecmp(entry->host, -1, uri->host, uri->hostlen))
return entry;
return NULL;

View File

@ -393,8 +393,8 @@ get_http_code(struct read_buffer *rb, int *code, struct http_version *version)
while (*head == ' ') head++;
/* HTTP/ */
if (toupper(*head) != 'H' || toupper(*++head) != 'T' ||
toupper(*++head) != 'T' || toupper(*++head) != 'P'
if (c_toupper(*head) != 'H' || c_toupper(*++head) != 'T' ||
c_toupper(*++head) != 'T' || c_toupper(*++head) != 'P'
|| *++head != '/')
return -1;
@ -1364,7 +1364,7 @@ get_header(struct read_buffer *rb)
/* XXX: We will have to do some guess about whether an HTTP header is
* coming or not, in order to support HTTP/0.9 reply correctly. This
* means a little code duplication with get_http_code(). --pasky */
if (rb->length > 4 && strncasecmp(rb->data, "HTTP/", 5))
if (rb->length > 4 && c_strncasecmp(rb->data, "HTTP/", 5))
return -2;
for (i = 0; i < rb->length; i++) {
@ -1401,7 +1401,7 @@ check_http_authentication(struct connection *conn, struct uri *uri,
d = parse_header(header, header_field, &str);
while (d) {
if (!strncasecmp(d, "Basic", 5)) {
if (!c_strncasecmp(d, "Basic", 5)) {
unsigned char *realm = get_header_param(d, "realm");
if (realm) {
@ -1410,7 +1410,7 @@ check_http_authentication(struct connection *conn, struct uri *uri,
mem_free(d);
break;
}
} else if (!strncasecmp(d, "Digest", 6)) {
} else if (!c_strncasecmp(d, "Digest", 6)) {
unsigned char *realm = get_header_param(d, "realm");
unsigned char *nonce = get_header_param(d, "nonce");
unsigned char *opaque = get_header_param(d, "opaque");
@ -1685,7 +1685,7 @@ again:
d = parse_header(conn->cached->head, "Proxy-Authenticate", &str);
while (d) {
if (!strncasecmp(d, "Basic", 5)) {
if (!c_strncasecmp(d, "Basic", 5)) {
unsigned char *realm = get_header_param(d, "realm");
if (realm) {
@ -1695,7 +1695,7 @@ again:
break;
}
} else if (!strncasecmp(d, "Digest", 6)) {
} else if (!c_strncasecmp(d, "Digest", 6)) {
unsigned char *realm = get_header_param(d, "realm");
unsigned char *nonce = get_header_param(d, "nonce");
unsigned char *opaque = get_header_param(d, "opaque");
@ -1721,7 +1721,7 @@ again:
if ((d = parse_header(conn->cached->head, "Connection", NULL))
|| (d = parse_header(conn->cached->head, "Proxy-Connection", NULL))) {
if (!strcasecmp(d, "close")) http->close = 1;
if (!c_strcasecmp(d, "close")) http->close = 1;
mem_free(d);
} else if (PRE_HTTP_1_1(version)) {
http->close = 1;
@ -1733,7 +1733,7 @@ again:
if (d) {
if (strlen(d) > 6) {
d[5] = 0;
if (isdigit(d[6]) && !strcasecmp(d, "bytes")) {
if (isdigit(d[6]) && !c_strcasecmp(d, "bytes")) {
int f;
errno = 0;
@ -1789,7 +1789,7 @@ again:
d = parse_header(conn->cached->head, "Accept-Ranges", NULL);
if (d) {
if (!strcasecmp(d, "none"))
if (!c_strcasecmp(d, "none"))
conn->unrestartable = 1;
mem_free(d);
} else {
@ -1800,7 +1800,7 @@ again:
d = parse_header(conn->cached->head, "Transfer-Encoding", NULL);
if (d) {
if (!strcasecmp(d, "chunked")) {
if (!c_strcasecmp(d, "chunked")) {
http->length = LEN_CHUNKED;
http->chunk_remaining = CHUNK_SIZE;
}
@ -1810,7 +1810,7 @@ again:
d = parse_header(conn->cached->head, "Last-Modified", NULL);
if (d) {
if (conn->cached->last_modified && strcasecmp(conn->cached->last_modified, d)) {
if (conn->cached->last_modified && c_strcasecmp(conn->cached->last_modified, d)) {
delete_entry_content(conn->cached);
if (conn->from) {
conn->from = 0;
@ -1872,7 +1872,7 @@ again:
* will leave the saved file with the correct encoding. */
#ifdef CONFIG_GZIP
if (file_encoding != ENCODING_GZIP
&& (!strcasecmp(d, "gzip") || !strcasecmp(d, "x-gzip")))
&& (!c_strcasecmp(d, "gzip") || !c_strcasecmp(d, "x-gzip")))
conn->content_encoding = ENCODING_GZIP;
if (!strcasecmp(d, "deflate") || !strcasecmp(d, "x-deflate"))
conn->content_encoding = ENCODING_DEFLATE;
@ -1880,7 +1880,7 @@ again:
#ifdef CONFIG_BZIP2
if (file_encoding != ENCODING_BZIP2
&& (!strcasecmp(d, "bzip2") || !strcasecmp(d, "x-bzip2")))
&& (!c_strcasecmp(d, "bzip2") || !c_strcasecmp(d, "x-bzip2")))
conn->content_encoding = ENCODING_BZIP2;
#endif

View File

@ -297,9 +297,9 @@ add_header_to_string(struct string *str, unsigned char *header)
break;
for (sp = end; sp < cp; sp++)
charset_q[sp - end] = tolower(*sp);
charset_q[sp - end] = c_tolower(*sp);
charset_q[cp - end] = 0;
encoding = tolower(cp[1]);
encoding = c_tolower(cp[1]);
if (!encoding || cp[2] != '?')
break;

View File

@ -114,7 +114,7 @@ get_protocol(unsigned char *name, int namelen)
unsigned char *pname = protocol_backends[protocol].name;
int pnamelen = strlen(pname);
int minlen = int_min(pnamelen, namelen);
int compare = strncasecmp(pname, name, minlen);
int compare = c_strncasecmp(pname, name, minlen);
if (compare == 0) {
if (pnamelen == namelen)

View File

@ -86,9 +86,9 @@ strip_proxy_protocol(unsigned char *proxy,
{
assert(proxy && *proxy);
if (!strncasecmp(proxy, strip1, strlen(strip1)))
if (!c_strncasecmp(proxy, strip1, strlen(strip1)))
proxy += strlen(strip1);
else if (strip2 && !strncasecmp(proxy, strip2, strlen(strip2)))
else if (strip2 && !c_strncasecmp(proxy, strip2, strlen(strip2)))
proxy += strlen(strip2);
return proxy;

View File

@ -67,13 +67,13 @@ is_in_domain(unsigned char *domain, unsigned char *server, int server_len)
return 0;
if (domain_len == server_len)
return !strncasecmp(domain, server, server_len);
return !c_strncasecmp(domain, server, server_len);
len = server_len - domain_len;
if (server[len - 1] != '.')
return 0;
return !strncasecmp(domain, server + len, domain_len);
return !c_strncasecmp(domain, server + len, domain_len);
}
int
@ -131,7 +131,7 @@ end_with_known_tld(const unsigned char *s, int slen)
int tldlen = strlen(tld[i]);
int pos = slen - tldlen;
if (pos >= 0 && !strncasecmp(&s[pos], tld[i], tldlen))
if (pos >= 0 && !c_strncasecmp(&s[pos], tld[i], tldlen))
return pos;
}
@ -1023,7 +1023,7 @@ find_uri_protocol(unsigned char *newurl)
ch = newurl + strcspn(newurl, ".:/@");
if (*ch == '@'
|| (*ch == ':' && *newurl != '[' && strchr(newurl, '@'))
|| !strncasecmp(newurl, "ftp.", 4)) {
|| !c_strncasecmp(newurl, "ftp.", 4)) {
/* Contains user/password/ftp-hostname */
return PROTOCOL_FTP;
@ -1521,11 +1521,11 @@ check_uri_sanity(struct uri *uri)
int pos;
for (pos = 0; pos < uri->protocollen; pos++)
if (isupper(uri->string[pos])) goto error;
if (c_isupper(uri->string[pos])) goto error;
if (uri->hostlen)
for (pos = 0; pos < uri->hostlen; pos++)
if (isupper(uri->host[pos])) goto error;
if (c_isupper(uri->host[pos])) goto error;
return;
error:
INTERNAL("Uppercase letters detected in protocol or host part (%s).", struri(uri));

View File

@ -1297,7 +1297,7 @@ setup_download_handler(struct session *ses, struct download *loading,
goto plaintext_follow;
for (i = 0; known_types[i].type; i++) {
if (strcasecmp(ctype, known_types[i].type))
if (c_strcasecmp(ctype, known_types[i].type))
continue;
plaintext = known_types[i].plain;
@ -1307,7 +1307,7 @@ setup_download_handler(struct session *ses, struct download *loading,
xwin = ses->tab->term->environment & ENV_XWIN;
handler = get_mime_type_handler(ctype, xwin);
if (!handler && strlen(ctype) >= 4 && !strncasecmp(ctype, "text", 4))
if (!handler && strlen(ctype) >= 4 && !c_strncasecmp(ctype, "text", 4))
goto plaintext_follow;
type_query = init_type_query(ses, loading, cached);
@ -1316,8 +1316,8 @@ setup_download_handler(struct session *ses, struct download *loading,
#ifdef CONFIG_BITTORRENT
/* A terrible waste of a good MIME handler here, but we want
* to use the type_query this is easier. */
if ((!strcasecmp(ctype, "application/x-bittorrent")
|| !strcasecmp(ctype, "application/x-torrent"))
if ((!c_strcasecmp(ctype, "application/x-bittorrent")
|| !c_strcasecmp(ctype, "application/x-torrent"))
&& !get_cmd_opt_bool("anonymous"))
query_bittorrent_dialog(type_query);
else

View File

@ -341,7 +341,7 @@ request_frame(struct session *ses, unsigned char *name,
foreach (frame, loc->frames) {
struct document_view *doc_view;
if (strcasecmp(frame->name, name))
if (c_strcasecmp(frame->name, name))
continue;
foreach (doc_view, ses->scrn_frames) {
@ -1238,7 +1238,7 @@ ses_find_frame(struct session *ses, unsigned char *name)
if_assert_failed return NULL;
foreachback (frame, loc->frames)
if (!strcasecmp(frame->name, name))
if (!c_strcasecmp(frame->name, name))
return frame;
return NULL;

View File

@ -69,7 +69,7 @@ void
init_colors_lookup(void)
{
#ifdef USE_FASTFIND
fastfind_index(&ff_colors_index, FF_COMPRESS);
fastfind_index(&ff_colors_index, FF_COMPRESS | FF_LOCALE_INDEP);
#endif
}
@ -112,7 +112,7 @@ decode_hex_color:
#ifndef USE_FASTFIND
for (cs = color_specs; cs->name; cs++)
if (!strlcasecmp(cs->name, -1, str, slen))
if (!c_strlcasecmp(cs->name, -1, str, slen))
break;
#else
cs = fastfind_search(&ff_colors_index, str, slen);

View File

@ -25,7 +25,7 @@ map_scanner_string(struct scanner *scanner,
for (; mappings->name; mappings++) {
if (mappings->base_type == base_type
&& !strlcasecmp(mappings->name, -1, ident, length))
&& !c_strlcasecmp(mappings->name, -1, ident, length))
return mappings->type;
}

View File

@ -2,6 +2,7 @@
#define EL__UTIL_SCANNER_H
#include "util/error.h"
#include "util/string.h"
/* Define if you want a talking scanner */
/* #define DEBUG_SCANNER */
@ -29,7 +30,7 @@ struct scanner_token {
/** Compare the string of @a token with @a str */
#define scanner_token_strlcasecmp(token, str, len) \
((token) && !strlcasecmp((token)->string, (token)->length, str, len))
((token) && !c_strlcasecmp((token)->string, (token)->length, str, len))
/** Also compares the token string but using a "static" string */
#define scanner_token_contains(token, str) \