mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -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:
parent
86085de07e
commit
96b3093519
@ -319,7 +319,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
|
|||||||
for (method = 0; remote_methods[method].name; method++) {
|
for (method = 0; remote_methods[method].name; method++) {
|
||||||
unsigned char *name = remote_methods[method].name;
|
unsigned char *name = remote_methods[method].name;
|
||||||
|
|
||||||
if (!strlcasecmp(command, len, name, -1))
|
if (!c_strlcasecmp(command, len, name, -1))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
|
|||||||
if (remote_argc < 1)
|
if (remote_argc < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!strcasecmp(remote_argv[0], "openBrowser")) {
|
if (!c_strcasecmp(remote_argv[0], "openBrowser")) {
|
||||||
remote_session_flags = SES_REMOTE_NEW_WINDOW;
|
remote_session_flags = SES_REMOTE_NEW_WINDOW;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -448,7 +448,7 @@ print_full_help_inner(struct option *tree, unsigned char *path,
|
|||||||
|| (option->flags & OPT_HIDDEN))
|
|| (option->flags & OPT_HIDDEN))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!capt && !strncasecmp(option->name, "_template_", 10))
|
if (!capt && !c_strncasecmp(option->name, "_template_", 10))
|
||||||
capt = (unsigned char *) N_("Template option folder");
|
capt = (unsigned char *) N_("Template option folder");
|
||||||
|
|
||||||
if (!capt) {
|
if (!capt) {
|
||||||
|
@ -363,7 +363,7 @@ read_key(const unsigned char *key_str)
|
|||||||
return key_str[0];
|
return key_str[0];
|
||||||
|
|
||||||
for (key = key_table; key->str; key++)
|
for (key = key_table; key->str; key++)
|
||||||
if (!strcasecmp(key->str, key_str))
|
if (!c_strcasecmp(key->str, key_str))
|
||||||
return key->num;
|
return key->num;
|
||||||
|
|
||||||
return KBD_UNDEF;
|
return KBD_UNDEF;
|
||||||
@ -377,17 +377,17 @@ parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
|
|||||||
{
|
{
|
||||||
kbd->modifier = KBD_MOD_NONE;
|
kbd->modifier = KBD_MOD_NONE;
|
||||||
while (1) {
|
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 */
|
/* Shift+a == shiFt-a == Shift-a */
|
||||||
kbd->modifier |= KBD_MOD_SHIFT;
|
kbd->modifier |= KBD_MOD_SHIFT;
|
||||||
s += 6;
|
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 */
|
/* Ctrl+a == ctRl-a == Ctrl-a */
|
||||||
kbd->modifier |= KBD_MOD_CTRL;
|
kbd->modifier |= KBD_MOD_CTRL;
|
||||||
s += 5;
|
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 */
|
/* Alt+a == aLt-a == Alt-a */
|
||||||
kbd->modifier |= KBD_MOD_ALT;
|
kbd->modifier |= KBD_MOD_ALT;
|
||||||
s += 4;
|
s += 4;
|
||||||
|
@ -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"
|
/* XXX: We must count with cases like "x.co" vs "x.co.uk"
|
||||||
* below! */
|
* below! */
|
||||||
int cslen = strlen(cs->host);
|
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))) {
|
if (!sort_spot && (cmp > 0 || (cmp == 0 && cslen > hostlen))) {
|
||||||
/* This is the first @cs with name greater than @host,
|
/* 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.. */
|
/* 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;
|
if (domain_len > server_len) return 0;
|
||||||
|
|
||||||
/* Ensure that the domain is atleast a substring of the server before
|
/* Ensure that the domain is atleast a substring of the server before
|
||||||
* continuing. */
|
* continuing. */
|
||||||
if (strncasecmp(domain, server + server_len - domain_len, domain_len))
|
if (c_strncasecmp(domain, server + server_len - domain_len, domain_len))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Allow domains which are same as servers. --<rono@sentuny.com.au> */
|
/* Allow domains which are same as servers. --<rono@sentuny.com.au> */
|
||||||
@ -498,8 +498,8 @@ accept_cookie(struct cookie *cookie)
|
|||||||
struct cookie *c, *next;
|
struct cookie *c, *next;
|
||||||
|
|
||||||
foreachsafe (c, next, cookies) {
|
foreachsafe (c, next, cookies) {
|
||||||
if (strcasecmp(c->name, cookie->name)
|
if (c_strcasecmp(c->name, cookie->name)
|
||||||
|| strcasecmp(c->domain, cookie->domain))
|
|| c_strcasecmp(c->domain, cookie->domain))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
delete_cookie(c);
|
delete_cookie(c);
|
||||||
@ -512,7 +512,7 @@ accept_cookie(struct cookie *cookie)
|
|||||||
|
|
||||||
/* XXX: This crunches CPU too. --pasky */
|
/* XXX: This crunches CPU too. --pasky */
|
||||||
foreach (cd, c_domains)
|
foreach (cd, c_domains)
|
||||||
if (!strcasecmp(cd->domain, cookie->domain))
|
if (!c_strcasecmp(cd->domain, cookie->domain))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
domain_len = strlen(cookie->domain);
|
domain_len = strlen(cookie->domain);
|
||||||
@ -534,11 +534,11 @@ delete_cookie(struct cookie *c)
|
|||||||
struct cookie *d;
|
struct cookie *d;
|
||||||
|
|
||||||
foreach (d, cookies)
|
foreach (d, cookies)
|
||||||
if (!strcasecmp(d->domain, c->domain))
|
if (!c_strcasecmp(d->domain, c->domain))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
foreach (cd, c_domains) {
|
foreach (cd, c_domains) {
|
||||||
if (!strcasecmp(cd->domain, c->domain)) {
|
if (!c_strcasecmp(cd->domain, c->domain)) {
|
||||||
del_from_list(cd);
|
del_from_list(cd);
|
||||||
mem_free(cd);
|
mem_free(cd);
|
||||||
break;
|
break;
|
||||||
|
@ -287,7 +287,7 @@ scan_css_token(struct scanner *scanner, struct scanner_token *token)
|
|||||||
|
|
||||||
} else if (first_char == '!') {
|
} else if (first_char == '!') {
|
||||||
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
|
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
|
||||||
if (!strncasecmp(string, "important", 9)) {
|
if (!c_strncasecmp(string, "important", 9)) {
|
||||||
type = CSS_TOKEN_IMPORTANT;
|
type = CSS_TOKEN_IMPORTANT;
|
||||||
string += 9;
|
string += 9;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ find_css_selector(LIST_OF(struct css_selector) *sels,
|
|||||||
foreach (selector, *sels) {
|
foreach (selector, *sels) {
|
||||||
if (type != selector->type || rel != selector->relation)
|
if (type != selector->type || rel != selector->relation)
|
||||||
continue;
|
continue;
|
||||||
if (strlcasecmp(name, namelen, selector->name, -1))
|
if (c_strlcasecmp(name, namelen, selector->name, -1))
|
||||||
continue;
|
continue;
|
||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
@ -993,22 +993,22 @@ static struct dom_stack_context_info dom_rss_renderer_context_info = {
|
|||||||
static void
|
static void
|
||||||
get_doctype(struct dom_renderer *renderer, struct cache_entry *cached)
|
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;
|
renderer->doctype = SGML_DOCTYPE_RSS;
|
||||||
|
|
||||||
} else if (!strcasecmp("application/docbook+xml",
|
} else if (!c_strcasecmp("application/docbook+xml",
|
||||||
cached->content_type)) {
|
cached->content_type)) {
|
||||||
renderer->doctype = SGML_DOCTYPE_DOCBOOK;
|
renderer->doctype = SGML_DOCTYPE_DOCBOOK;
|
||||||
|
|
||||||
} else if (!strcasecmp("application/xbel+xml", cached->content_type)
|
} else if (!c_strcasecmp("application/xbel+xml", cached->content_type)
|
||||||
|| !strcasecmp("application/x-xbel", cached->content_type)
|
|| !c_strcasecmp("application/x-xbel", cached->content_type)
|
||||||
|| !strcasecmp("application/xbel", cached->content_type)) {
|
|| !c_strcasecmp("application/xbel", cached->content_type)) {
|
||||||
renderer->doctype = SGML_DOCTYPE_XBEL;
|
renderer->doctype = SGML_DOCTYPE_XBEL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
assertm(!strcasecmp("text/html", cached->content_type)
|
assertm(!c_strcasecmp("text/html", cached->content_type)
|
||||||
|| !strcasecmp("application/xhtml+xml",
|
|| !c_strcasecmp("application/xhtml+xml",
|
||||||
cached->content_type),
|
cached->content_type),
|
||||||
"Couldn't resolve doctype '%s'", cached->content_type);
|
"Couldn't resolve doctype '%s'", cached->content_type);
|
||||||
|
|
||||||
renderer->doctype = SGML_DOCTYPE_HTML;
|
renderer->doctype = SGML_DOCTYPE_HTML;
|
||||||
|
@ -893,7 +893,7 @@ html_li(struct html_context *html_context, unsigned char *a,
|
|||||||
if (t == P_ROMAN) {
|
if (t == P_ROMAN) {
|
||||||
unsigned char *x;
|
unsigned char *x;
|
||||||
|
|
||||||
for (x = n; *x; x++) *x = toupper(*x);
|
for (x = n; *x; x++) *x = c_toupper(*x);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -243,8 +243,8 @@ kill_html_stack_until(struct html_context *html_context, int ls, ...)
|
|||||||
|| (!c_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 && c_toupper(e->name[0]) == 'T') {
|
||||||
unsigned char c = toupper(e->name[1]);
|
unsigned char c = c_toupper(e->name[1]);
|
||||||
|
|
||||||
if (c == 'D' || c == 'H' || c == 'R')
|
if (c == 'D' || c == 'H' || c == 'R')
|
||||||
break;
|
break;
|
||||||
|
@ -684,12 +684,12 @@ see:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All following tags have T as first letter. */
|
/* 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--;
|
name++; namelen--;
|
||||||
if (namelen == 0) goto see;
|
if (namelen == 0) goto see;
|
||||||
|
|
||||||
c = toupper(name[0]);
|
c = c_toupper(name[0]);
|
||||||
|
|
||||||
/* /TR /TD /TH */
|
/* /TR /TD /TH */
|
||||||
if (closing_tag && namelen == 1) {
|
if (closing_tag && namelen == 1) {
|
||||||
|
@ -95,7 +95,7 @@ int
|
|||||||
compare_opt(struct document_options *o1, struct document_options *o2)
|
compare_opt(struct document_options *o1, struct document_options *o2)
|
||||||
{
|
{
|
||||||
return memcmp(o1, o2, offsetof(struct document_options, framename))
|
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.x != o2->box.x)
|
||||||
|| (o1->box.y != o2->box.y)
|
|| (o1->box.y != o2->box.y)
|
||||||
|| ((o1->needs_height || o2->needs_height)
|
|| ((o1->needs_height || o2->needs_height)
|
||||||
|
@ -243,13 +243,13 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
if (document->options.plain) {
|
if (document->options.plain) {
|
||||||
#ifdef CONFIG_DOM
|
#ifdef CONFIG_DOM
|
||||||
if (cached->content_type
|
if (cached->content_type
|
||||||
&& (!strcasecmp("text/html", cached->content_type)
|
&& (!c_strcasecmp("text/html", cached->content_type)
|
||||||
|| !strcasecmp("application/xhtml+xml", cached->content_type)
|
|| !c_strcasecmp("application/xhtml+xml", cached->content_type)
|
||||||
|| !strcasecmp("application/docbook+xml", cached->content_type)
|
|| !c_strcasecmp("application/docbook+xml", cached->content_type)
|
||||||
|| !strcasecmp("application/rss+xml", cached->content_type)
|
|| !c_strcasecmp("application/rss+xml", cached->content_type)
|
||||||
|| !strcasecmp("application/xbel+xml", cached->content_type)
|
|| !c_strcasecmp("application/xbel+xml", cached->content_type)
|
||||||
|| !strcasecmp("application/x-xbel", cached->content_type)
|
|| !c_strcasecmp("application/x-xbel", cached->content_type)
|
||||||
|| !strcasecmp("application/xbel", cached->content_type)))
|
|| !c_strcasecmp("application/xbel", cached->content_type)))
|
||||||
render_dom_document(cached, document, &buffer);
|
render_dom_document(cached, document, &buffer);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -258,7 +258,7 @@ render_encoded_document(struct cache_entry *cached, struct document *document)
|
|||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_DOM
|
#ifdef CONFIG_DOM
|
||||||
if (cached->content_type
|
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);
|
render_dom_document(cached, document, &buffer);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,7 +290,7 @@ scan_css_token(struct dom_scanner *scanner, struct dom_scanner_token *token)
|
|||||||
|
|
||||||
} else if (first_char == '!') {
|
} else if (first_char == '!') {
|
||||||
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
|
scan_css(scanner, string, CSS_CHAR_WHITESPACE);
|
||||||
if (!strncasecmp(string, "important", 9)) {
|
if (!c_strncasecmp(string, "important", 9)) {
|
||||||
type = CSS_TOKEN_IMPORTANT;
|
type = CSS_TOKEN_IMPORTANT;
|
||||||
string += 9;
|
string += 9;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ struct dom_scanner_token {
|
|||||||
/** Compare the token string to a "static" string */
|
/** Compare the token string to a "static" string */
|
||||||
#define dom_scanner_token_contains(token, str) \
|
#define dom_scanner_token_contains(token, str) \
|
||||||
((token)->string.length == (sizeof(str) - 1) \
|
((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 {
|
struct dom_scan_table_info {
|
||||||
|
@ -31,9 +31,9 @@ static inline int
|
|||||||
dom_string_casecmp(const struct dom_string *string1, const struct dom_string *string2)
|
dom_string_casecmp(const struct dom_string *string1, const struct dom_string *string2)
|
||||||
{
|
{
|
||||||
size_t length = int_min(string1->length, string2->length);
|
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. */
|
* job else return which ever is bigger. */
|
||||||
return string_diff ? string_diff : string1->length - string2->length;
|
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
|
static inline int
|
||||||
dom_string_ncasecmp(struct dom_string *string1, struct dom_string *string2, size_t length)
|
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) \
|
#define copy_dom_string(string1, string2) \
|
||||||
|
@ -126,7 +126,7 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
foreach (form, document->forms) {
|
foreach (form, document->forms) {
|
||||||
if (!form->name || strcasecmp(string, form->name))
|
if (!form->name || c_strcasecmp(string, form->name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
object_to_jsval(ctx, vp, get_form_object(ctx, obj, find_form_view(doc_view, form)));
|
object_to_jsval(ctx, vp, get_form_object(ctx, obj, find_form_view(doc_view, form)));
|
||||||
|
@ -857,7 +857,8 @@ form_elements_namedItem(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv,
|
|||||||
undef_to_jsval(ctx, rval);
|
undef_to_jsval(ctx, rval);
|
||||||
|
|
||||||
foreach (fc, form->items) {
|
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);
|
struct form_state *fs = find_form_state(doc_view, fc);
|
||||||
|
|
||||||
if (fs) {
|
if (fs) {
|
||||||
@ -979,7 +980,8 @@ form_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
JSObject *fcobj = NULL;
|
JSObject *fcobj = NULL;
|
||||||
struct form_state *fs;
|
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;
|
continue;
|
||||||
|
|
||||||
undef_to_jsval(ctx, vp);
|
undef_to_jsval(ctx, vp);
|
||||||
@ -1120,21 +1122,21 @@ form_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
|||||||
|
|
||||||
case JSP_FORM_ENCODING:
|
case JSP_FORM_ENCODING:
|
||||||
string = jsval_to_string(ctx, vp);
|
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 = form->method == FORM_METHOD_GET ? FORM_METHOD_GET
|
||||||
: FORM_METHOD_POST;
|
: FORM_METHOD_POST;
|
||||||
} else if (!strcasecmp(string, "multipart/form-data")) {
|
} else if (!c_strcasecmp(string, "multipart/form-data")) {
|
||||||
form->method = FORM_METHOD_POST_MP;
|
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;
|
form->method = FORM_METHOD_POST_TEXT_PLAIN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JSP_FORM_METHOD:
|
case JSP_FORM_METHOD:
|
||||||
string = jsval_to_string(ctx, vp);
|
string = jsval_to_string(ctx, vp);
|
||||||
if (!strcasecmp(string, "GET")) {
|
if (!c_strcasecmp(string, "GET")) {
|
||||||
form->method = FORM_METHOD_GET;
|
form->method = FORM_METHOD_GET;
|
||||||
} else if (!strcasecmp(string, "POST")) {
|
} else if (!c_strcasecmp(string, "POST")) {
|
||||||
form->method = FORM_METHOD_POST;
|
form->method = FORM_METHOD_POST;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1353,7 +1355,7 @@ find_form_by_name(JSContext *ctx, JSObject *jsdoc,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (form, doc_view->document->forms) {
|
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,
|
object_to_jsval(ctx, rval, get_form_object(ctx, jsdoc,
|
||||||
find_form_view(doc_view, form)));
|
find_form_view(doc_view, form)));
|
||||||
break;
|
break;
|
||||||
|
@ -399,7 +399,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||||||
return JS_TRUE;
|
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));
|
struct delayed_open *deo = mem_calloc(1, sizeof(*deo));
|
||||||
|
|
||||||
if (deo) {
|
if (deo) {
|
||||||
|
@ -1313,7 +1313,7 @@ get_cp_index(const unsigned char *name)
|
|||||||
int i, a;
|
int i, a;
|
||||||
int syscp = 0;
|
int syscp = 0;
|
||||||
|
|
||||||
if (!strcasecmp(name, "System")) {
|
if (!c_strcasecmp(name, "System")) {
|
||||||
#if HAVE_LANGINFO_CODESET
|
#if HAVE_LANGINFO_CODESET
|
||||||
name = nl_langinfo(CODESET);
|
name = nl_langinfo(CODESET);
|
||||||
syscp = SYSTEM_CHARSET_FLAG;
|
syscp = SYSTEM_CHARSET_FLAG;
|
||||||
@ -1336,7 +1336,7 @@ get_cp_index(const unsigned char *name)
|
|||||||
* once. So we will do a simple strcasecmp() here.
|
* 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;
|
return i | syscp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1394,7 +1394,7 @@ get_cp_index(const unsigned char *name)
|
|||||||
const struct codepage_desc *codepage;
|
const struct codepage_desc *codepage;
|
||||||
int syscp = 0;
|
int syscp = 0;
|
||||||
|
|
||||||
if (!strcasecmp(name, "System")) {
|
if (!c_strcasecmp(name, "System")) {
|
||||||
#if HAVE_LANGINFO_CODESET
|
#if HAVE_LANGINFO_CODESET
|
||||||
name = nl_langinfo(CODESET);
|
name = nl_langinfo(CODESET);
|
||||||
syscp = SYSTEM_CHARSET_FLAG;
|
syscp = SYSTEM_CHARSET_FLAG;
|
||||||
|
@ -349,7 +349,7 @@ _nl_normalize_codeset(const unsigned char *codeset, size_t name_len)
|
|||||||
|
|
||||||
for (cnt = 0; cnt < name_len; ++cnt)
|
for (cnt = 0; cnt < name_len; ++cnt)
|
||||||
if (isalpha(codeset[cnt]))
|
if (isalpha(codeset[cnt]))
|
||||||
*wp++ = tolower(codeset[cnt]);
|
*wp++ = c_tolower(codeset[cnt]);
|
||||||
else if (isdigit(codeset[cnt]))
|
else if (isdigit(codeset[cnt]))
|
||||||
*wp++ = codeset[cnt];
|
*wp++ = codeset[cnt];
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ name_to_language(const unsigned char *name)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; languages[i].name; i++) {
|
for (i = 0; languages[i].name; i++) {
|
||||||
if (strcasecmp(languages[i].name, name))
|
if (c_strcasecmp(languages[i].name, name))
|
||||||
continue;
|
continue;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -285,5 +285,5 @@ extend_alias_table(void)
|
|||||||
static int
|
static int
|
||||||
alias_compare(const struct alias_map *map1, const struct alias_map *map2)
|
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);
|
||||||
}
|
}
|
||||||
|
@ -280,13 +280,13 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
|
|||||||
|
|
||||||
if (!field) break;
|
if (!field) break;
|
||||||
|
|
||||||
if (!strncasecmp(field, "needsterminal", 13)) {
|
if (!c_strncasecmp(field, "needsterminal", 13)) {
|
||||||
entry->needsterminal = 1;
|
entry->needsterminal = 1;
|
||||||
|
|
||||||
} else if (!strncasecmp(field, "copiousoutput", 13)) {
|
} else if (!c_strncasecmp(field, "copiousoutput", 13)) {
|
||||||
entry->copiousoutput = 1;
|
entry->copiousoutput = 1;
|
||||||
|
|
||||||
} else if (!strncasecmp(field, "test", 4)) {
|
} else if (!c_strncasecmp(field, "test", 4)) {
|
||||||
entry->testcommand = get_mailcap_field_text(field + 4);
|
entry->testcommand = get_mailcap_field_text(field + 4);
|
||||||
if (!entry->testcommand)
|
if (!entry->testcommand)
|
||||||
return 0;
|
return 0;
|
||||||
@ -298,7 +298,7 @@ parse_optional_fields(struct mailcap_entry *entry, unsigned char *line)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!strncasecmp(field, "description", 11)) {
|
} else if (!c_strncasecmp(field, "description", 11)) {
|
||||||
entry->description = get_mailcap_field_text(field + 11);
|
entry->description = get_mailcap_field_text(field + 11);
|
||||||
if (!entry->description)
|
if (!entry->description)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -89,7 +89,7 @@ find_in_dns_cache(unsigned char *name)
|
|||||||
struct dnsentry *dnsentry;
|
struct dnsentry *dnsentry;
|
||||||
|
|
||||||
foreach (dnsentry, dns_cache)
|
foreach (dnsentry, dns_cache)
|
||||||
if (!strcasecmp(dnsentry->name, name)) {
|
if (!c_strcasecmp(dnsentry->name, name)) {
|
||||||
move_to_top_of_list(dns_cache, dnsentry);
|
move_to_top_of_list(dns_cache, dnsentry);
|
||||||
return dnsentry;
|
return dnsentry;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ auth_user_matching_uri(struct auth_entry *auth, struct uri *uri)
|
|||||||
{
|
{
|
||||||
if (!uri->userlen) /* Noone said it doesn't. */
|
if (!uri->userlen) /* Noone said it doesn't. */
|
||||||
return 1;
|
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)
|
if (pos + 4 > data_len)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (strncasecmp(&data[pos], "byte", 4))
|
if (c_strncasecmp(&data[pos], "byte", 4))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
@ -224,7 +224,7 @@ add_gopher_command(struct connection *conn, struct string *command,
|
|||||||
querylen = selector + selectorlen - query;
|
querylen = selector + selectorlen - query;
|
||||||
/* Exclude '?' */
|
/* Exclude '?' */
|
||||||
selectorlen -= querylen + 1;
|
selectorlen -= querylen + 1;
|
||||||
if (querylen >= 7 && !strncasecmp(query, "search=", 7)) {
|
if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) {
|
||||||
query += 7;
|
query += 7;
|
||||||
querylen -= 7;
|
querylen -= 7;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ parse_header(unsigned char *head, unsigned char *item, unsigned char **ptr)
|
|||||||
|
|
||||||
/* Does item match header line ? */
|
/* Does item match header line ? */
|
||||||
for (itempos = item; *itempos && *pos; itempos++, pos++)
|
for (itempos = item; *itempos && *pos; itempos++, pos++)
|
||||||
if (toupper(*itempos) != toupper(*pos))
|
if (c_toupper(*itempos) != c_toupper(*pos))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!*pos) break; /* Nothing left to parse. */
|
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++;
|
while (*p && (*p == ';' || *p <= ' ')) p++;
|
||||||
if (strlen(p) < namelen) return HEADER_PARAM_NOT_FOUND;
|
if (strlen(p) < namelen) return HEADER_PARAM_NOT_FOUND;
|
||||||
} while (strncasecmp(p, name, namelen));
|
} while (c_strncasecmp(p, name, namelen));
|
||||||
|
|
||||||
p += namelen;
|
p += namelen;
|
||||||
|
|
||||||
@ -275,11 +275,11 @@ get_header_param(unsigned char *e, unsigned char *name)
|
|||||||
unsigned char *n, *start;
|
unsigned char *n, *start;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
while (*e && toupper(*e++) != toupper(*name));
|
while (*e && c_toupper(*e++) != c_toupper(*name));
|
||||||
if (!*e) return NULL;
|
if (!*e) return NULL;
|
||||||
|
|
||||||
n = name + 1;
|
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;
|
if (*n) goto again;
|
||||||
|
|
||||||
skip_space(e);
|
skip_space(e);
|
||||||
|
@ -34,7 +34,7 @@ get_blacklist_entry(struct uri *uri)
|
|||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
|
|
||||||
foreach (entry, blacklist)
|
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 entry;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -393,8 +393,8 @@ get_http_code(struct read_buffer *rb, int *code, struct http_version *version)
|
|||||||
while (*head == ' ') head++;
|
while (*head == ' ') head++;
|
||||||
|
|
||||||
/* HTTP/ */
|
/* HTTP/ */
|
||||||
if (toupper(*head) != 'H' || toupper(*++head) != 'T' ||
|
if (c_toupper(*head) != 'H' || c_toupper(*++head) != 'T' ||
|
||||||
toupper(*++head) != 'T' || toupper(*++head) != 'P'
|
c_toupper(*++head) != 'T' || c_toupper(*++head) != 'P'
|
||||||
|| *++head != '/')
|
|| *++head != '/')
|
||||||
return -1;
|
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
|
/* 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
|
* coming or not, in order to support HTTP/0.9 reply correctly. This
|
||||||
* means a little code duplication with get_http_code(). --pasky */
|
* 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;
|
return -2;
|
||||||
|
|
||||||
for (i = 0; i < rb->length; i++) {
|
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);
|
d = parse_header(header, header_field, &str);
|
||||||
while (d) {
|
while (d) {
|
||||||
if (!strncasecmp(d, "Basic", 5)) {
|
if (!c_strncasecmp(d, "Basic", 5)) {
|
||||||
unsigned char *realm = get_header_param(d, "realm");
|
unsigned char *realm = get_header_param(d, "realm");
|
||||||
|
|
||||||
if (realm) {
|
if (realm) {
|
||||||
@ -1410,7 +1410,7 @@ check_http_authentication(struct connection *conn, struct uri *uri,
|
|||||||
mem_free(d);
|
mem_free(d);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (!strncasecmp(d, "Digest", 6)) {
|
} else if (!c_strncasecmp(d, "Digest", 6)) {
|
||||||
unsigned char *realm = get_header_param(d, "realm");
|
unsigned char *realm = get_header_param(d, "realm");
|
||||||
unsigned char *nonce = get_header_param(d, "nonce");
|
unsigned char *nonce = get_header_param(d, "nonce");
|
||||||
unsigned char *opaque = get_header_param(d, "opaque");
|
unsigned char *opaque = get_header_param(d, "opaque");
|
||||||
@ -1685,7 +1685,7 @@ again:
|
|||||||
|
|
||||||
d = parse_header(conn->cached->head, "Proxy-Authenticate", &str);
|
d = parse_header(conn->cached->head, "Proxy-Authenticate", &str);
|
||||||
while (d) {
|
while (d) {
|
||||||
if (!strncasecmp(d, "Basic", 5)) {
|
if (!c_strncasecmp(d, "Basic", 5)) {
|
||||||
unsigned char *realm = get_header_param(d, "realm");
|
unsigned char *realm = get_header_param(d, "realm");
|
||||||
|
|
||||||
if (realm) {
|
if (realm) {
|
||||||
@ -1695,7 +1695,7 @@ again:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!strncasecmp(d, "Digest", 6)) {
|
} else if (!c_strncasecmp(d, "Digest", 6)) {
|
||||||
unsigned char *realm = get_header_param(d, "realm");
|
unsigned char *realm = get_header_param(d, "realm");
|
||||||
unsigned char *nonce = get_header_param(d, "nonce");
|
unsigned char *nonce = get_header_param(d, "nonce");
|
||||||
unsigned char *opaque = get_header_param(d, "opaque");
|
unsigned char *opaque = get_header_param(d, "opaque");
|
||||||
@ -1721,7 +1721,7 @@ again:
|
|||||||
|
|
||||||
if ((d = parse_header(conn->cached->head, "Connection", NULL))
|
if ((d = parse_header(conn->cached->head, "Connection", NULL))
|
||||||
|| (d = parse_header(conn->cached->head, "Proxy-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);
|
mem_free(d);
|
||||||
} else if (PRE_HTTP_1_1(version)) {
|
} else if (PRE_HTTP_1_1(version)) {
|
||||||
http->close = 1;
|
http->close = 1;
|
||||||
@ -1733,7 +1733,7 @@ again:
|
|||||||
if (d) {
|
if (d) {
|
||||||
if (strlen(d) > 6) {
|
if (strlen(d) > 6) {
|
||||||
d[5] = 0;
|
d[5] = 0;
|
||||||
if (isdigit(d[6]) && !strcasecmp(d, "bytes")) {
|
if (isdigit(d[6]) && !c_strcasecmp(d, "bytes")) {
|
||||||
int f;
|
int f;
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@ -1789,7 +1789,7 @@ again:
|
|||||||
d = parse_header(conn->cached->head, "Accept-Ranges", NULL);
|
d = parse_header(conn->cached->head, "Accept-Ranges", NULL);
|
||||||
|
|
||||||
if (d) {
|
if (d) {
|
||||||
if (!strcasecmp(d, "none"))
|
if (!c_strcasecmp(d, "none"))
|
||||||
conn->unrestartable = 1;
|
conn->unrestartable = 1;
|
||||||
mem_free(d);
|
mem_free(d);
|
||||||
} else {
|
} else {
|
||||||
@ -1800,7 +1800,7 @@ again:
|
|||||||
|
|
||||||
d = parse_header(conn->cached->head, "Transfer-Encoding", NULL);
|
d = parse_header(conn->cached->head, "Transfer-Encoding", NULL);
|
||||||
if (d) {
|
if (d) {
|
||||||
if (!strcasecmp(d, "chunked")) {
|
if (!c_strcasecmp(d, "chunked")) {
|
||||||
http->length = LEN_CHUNKED;
|
http->length = LEN_CHUNKED;
|
||||||
http->chunk_remaining = CHUNK_SIZE;
|
http->chunk_remaining = CHUNK_SIZE;
|
||||||
}
|
}
|
||||||
@ -1810,7 +1810,7 @@ again:
|
|||||||
|
|
||||||
d = parse_header(conn->cached->head, "Last-Modified", NULL);
|
d = parse_header(conn->cached->head, "Last-Modified", NULL);
|
||||||
if (d) {
|
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);
|
delete_entry_content(conn->cached);
|
||||||
if (conn->from) {
|
if (conn->from) {
|
||||||
conn->from = 0;
|
conn->from = 0;
|
||||||
@ -1872,7 +1872,7 @@ again:
|
|||||||
* will leave the saved file with the correct encoding. */
|
* will leave the saved file with the correct encoding. */
|
||||||
#ifdef CONFIG_GZIP
|
#ifdef CONFIG_GZIP
|
||||||
if (file_encoding != ENCODING_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;
|
conn->content_encoding = ENCODING_GZIP;
|
||||||
if (!strcasecmp(d, "deflate") || !strcasecmp(d, "x-deflate"))
|
if (!strcasecmp(d, "deflate") || !strcasecmp(d, "x-deflate"))
|
||||||
conn->content_encoding = ENCODING_DEFLATE;
|
conn->content_encoding = ENCODING_DEFLATE;
|
||||||
@ -1880,7 +1880,7 @@ again:
|
|||||||
|
|
||||||
#ifdef CONFIG_BZIP2
|
#ifdef CONFIG_BZIP2
|
||||||
if (file_encoding != ENCODING_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;
|
conn->content_encoding = ENCODING_BZIP2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -297,9 +297,9 @@ add_header_to_string(struct string *str, unsigned char *header)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
for (sp = end; sp < cp; sp++)
|
for (sp = end; sp < cp; sp++)
|
||||||
charset_q[sp - end] = tolower(*sp);
|
charset_q[sp - end] = c_tolower(*sp);
|
||||||
charset_q[cp - end] = 0;
|
charset_q[cp - end] = 0;
|
||||||
encoding = tolower(cp[1]);
|
encoding = c_tolower(cp[1]);
|
||||||
|
|
||||||
if (!encoding || cp[2] != '?')
|
if (!encoding || cp[2] != '?')
|
||||||
break;
|
break;
|
||||||
|
@ -114,7 +114,7 @@ get_protocol(unsigned char *name, int namelen)
|
|||||||
unsigned char *pname = protocol_backends[protocol].name;
|
unsigned char *pname = protocol_backends[protocol].name;
|
||||||
int pnamelen = strlen(pname);
|
int pnamelen = strlen(pname);
|
||||||
int minlen = int_min(pnamelen, namelen);
|
int minlen = int_min(pnamelen, namelen);
|
||||||
int compare = strncasecmp(pname, name, minlen);
|
int compare = c_strncasecmp(pname, name, minlen);
|
||||||
|
|
||||||
if (compare == 0) {
|
if (compare == 0) {
|
||||||
if (pnamelen == namelen)
|
if (pnamelen == namelen)
|
||||||
|
@ -86,9 +86,9 @@ strip_proxy_protocol(unsigned char *proxy,
|
|||||||
{
|
{
|
||||||
assert(proxy && *proxy);
|
assert(proxy && *proxy);
|
||||||
|
|
||||||
if (!strncasecmp(proxy, strip1, strlen(strip1)))
|
if (!c_strncasecmp(proxy, strip1, strlen(strip1)))
|
||||||
proxy += 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);
|
proxy += strlen(strip2);
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
|
@ -67,13 +67,13 @@ is_in_domain(unsigned char *domain, unsigned char *server, int server_len)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (domain_len == server_len)
|
if (domain_len == server_len)
|
||||||
return !strncasecmp(domain, server, server_len);
|
return !c_strncasecmp(domain, server, server_len);
|
||||||
|
|
||||||
len = server_len - domain_len;
|
len = server_len - domain_len;
|
||||||
if (server[len - 1] != '.')
|
if (server[len - 1] != '.')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return !strncasecmp(domain, server + len, domain_len);
|
return !c_strncasecmp(domain, server + len, domain_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -131,7 +131,7 @@ end_with_known_tld(const unsigned char *s, int slen)
|
|||||||
int tldlen = strlen(tld[i]);
|
int tldlen = strlen(tld[i]);
|
||||||
int pos = slen - tldlen;
|
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;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,7 +1023,7 @@ find_uri_protocol(unsigned char *newurl)
|
|||||||
ch = newurl + strcspn(newurl, ".:/@");
|
ch = newurl + strcspn(newurl, ".:/@");
|
||||||
if (*ch == '@'
|
if (*ch == '@'
|
||||||
|| (*ch == ':' && *newurl != '[' && strchr(newurl, '@'))
|
|| (*ch == ':' && *newurl != '[' && strchr(newurl, '@'))
|
||||||
|| !strncasecmp(newurl, "ftp.", 4)) {
|
|| !c_strncasecmp(newurl, "ftp.", 4)) {
|
||||||
/* Contains user/password/ftp-hostname */
|
/* Contains user/password/ftp-hostname */
|
||||||
return PROTOCOL_FTP;
|
return PROTOCOL_FTP;
|
||||||
|
|
||||||
@ -1521,11 +1521,11 @@ check_uri_sanity(struct uri *uri)
|
|||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
for (pos = 0; pos < uri->protocollen; 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)
|
if (uri->hostlen)
|
||||||
for (pos = 0; pos < uri->hostlen; pos++)
|
for (pos = 0; pos < uri->hostlen; pos++)
|
||||||
if (isupper(uri->host[pos])) goto error;
|
if (c_isupper(uri->host[pos])) goto error;
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
INTERNAL("Uppercase letters detected in protocol or host part (%s).", struri(uri));
|
INTERNAL("Uppercase letters detected in protocol or host part (%s).", struri(uri));
|
||||||
|
@ -1297,7 +1297,7 @@ setup_download_handler(struct session *ses, struct download *loading,
|
|||||||
goto plaintext_follow;
|
goto plaintext_follow;
|
||||||
|
|
||||||
for (i = 0; known_types[i].type; i++) {
|
for (i = 0; known_types[i].type; i++) {
|
||||||
if (strcasecmp(ctype, known_types[i].type))
|
if (c_strcasecmp(ctype, known_types[i].type))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
plaintext = known_types[i].plain;
|
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;
|
xwin = ses->tab->term->environment & ENV_XWIN;
|
||||||
handler = get_mime_type_handler(ctype, 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;
|
goto plaintext_follow;
|
||||||
|
|
||||||
type_query = init_type_query(ses, loading, cached);
|
type_query = init_type_query(ses, loading, cached);
|
||||||
@ -1316,8 +1316,8 @@ setup_download_handler(struct session *ses, struct download *loading,
|
|||||||
#ifdef CONFIG_BITTORRENT
|
#ifdef CONFIG_BITTORRENT
|
||||||
/* A terrible waste of a good MIME handler here, but we want
|
/* A terrible waste of a good MIME handler here, but we want
|
||||||
* to use the type_query this is easier. */
|
* to use the type_query this is easier. */
|
||||||
if ((!strcasecmp(ctype, "application/x-bittorrent")
|
if ((!c_strcasecmp(ctype, "application/x-bittorrent")
|
||||||
|| !strcasecmp(ctype, "application/x-torrent"))
|
|| !c_strcasecmp(ctype, "application/x-torrent"))
|
||||||
&& !get_cmd_opt_bool("anonymous"))
|
&& !get_cmd_opt_bool("anonymous"))
|
||||||
query_bittorrent_dialog(type_query);
|
query_bittorrent_dialog(type_query);
|
||||||
else
|
else
|
||||||
|
@ -341,7 +341,7 @@ request_frame(struct session *ses, unsigned char *name,
|
|||||||
foreach (frame, loc->frames) {
|
foreach (frame, loc->frames) {
|
||||||
struct document_view *doc_view;
|
struct document_view *doc_view;
|
||||||
|
|
||||||
if (strcasecmp(frame->name, name))
|
if (c_strcasecmp(frame->name, name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (doc_view, ses->scrn_frames) {
|
foreach (doc_view, ses->scrn_frames) {
|
||||||
@ -1238,7 +1238,7 @@ ses_find_frame(struct session *ses, unsigned char *name)
|
|||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
|
|
||||||
foreachback (frame, loc->frames)
|
foreachback (frame, loc->frames)
|
||||||
if (!strcasecmp(frame->name, name))
|
if (!c_strcasecmp(frame->name, name))
|
||||||
return frame;
|
return frame;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -69,7 +69,7 @@ void
|
|||||||
init_colors_lookup(void)
|
init_colors_lookup(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_FASTFIND
|
#ifdef USE_FASTFIND
|
||||||
fastfind_index(&ff_colors_index, FF_COMPRESS);
|
fastfind_index(&ff_colors_index, FF_COMPRESS | FF_LOCALE_INDEP);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ decode_hex_color:
|
|||||||
|
|
||||||
#ifndef USE_FASTFIND
|
#ifndef USE_FASTFIND
|
||||||
for (cs = color_specs; cs->name; cs++)
|
for (cs = color_specs; cs->name; cs++)
|
||||||
if (!strlcasecmp(cs->name, -1, str, slen))
|
if (!c_strlcasecmp(cs->name, -1, str, slen))
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
cs = fastfind_search(&ff_colors_index, str, slen);
|
cs = fastfind_search(&ff_colors_index, str, slen);
|
||||||
|
@ -25,7 +25,7 @@ map_scanner_string(struct scanner *scanner,
|
|||||||
|
|
||||||
for (; mappings->name; mappings++) {
|
for (; mappings->name; mappings++) {
|
||||||
if (mappings->base_type == base_type
|
if (mappings->base_type == base_type
|
||||||
&& !strlcasecmp(mappings->name, -1, ident, length))
|
&& !c_strlcasecmp(mappings->name, -1, ident, length))
|
||||||
return mappings->type;
|
return mappings->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define EL__UTIL_SCANNER_H
|
#define EL__UTIL_SCANNER_H
|
||||||
|
|
||||||
#include "util/error.h"
|
#include "util/error.h"
|
||||||
|
#include "util/string.h"
|
||||||
|
|
||||||
/* Define if you want a talking scanner */
|
/* Define if you want a talking scanner */
|
||||||
/* #define DEBUG_SCANNER */
|
/* #define DEBUG_SCANNER */
|
||||||
@ -29,7 +30,7 @@ struct scanner_token {
|
|||||||
|
|
||||||
/** Compare the string of @a token with @a str */
|
/** Compare the string of @a token with @a str */
|
||||||
#define scanner_token_strlcasecmp(token, str, len) \
|
#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 */
|
/** Also compares the token string but using a "static" string */
|
||||||
#define scanner_token_contains(token, str) \
|
#define scanner_token_contains(token, str) \
|
||||||
|
Loading…
Reference in New Issue
Block a user