1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00

Explicit cast to (const char *) in strcasestr for C++

This commit is contained in:
Witold Filipczyk 2016-04-20 20:11:08 +02:00
parent 52d6f37c8e
commit 1b06539694
9 changed files with 19 additions and 19 deletions

View File

@ -799,7 +799,7 @@ search_menu_item(struct menu_item *item, unsigned char *buffer,
if (match) if (match)
memmove(match, match + 1, strlen(match)); memmove(match, match + 1, strlen(match));
match = strcasestr(text, buffer); match = strcasestr((const char *)text, (const char *)buffer);
mem_free(text); mem_free(text);
return !!match; return !!match;

View File

@ -663,7 +663,7 @@ test_search(struct listbox_item *item, void *data_, int *offset)
assert(ctx->title && ctx->url); assert(ctx->title && ctx->url);
ctx->found = (*ctx->url && c_strcasestr(bm->url, ctx->url)); ctx->found = (*ctx->url && c_strcasestr((const char *)bm->url, (const char *)ctx->url));
if (!ctx->found && *ctx->title) { if (!ctx->found && *ctx->title) {
/* The comparison of bookmark titles should /* The comparison of bookmark titles should
* be case-insensitive and locale-sensitive * be case-insensitive and locale-sensitive
@ -687,7 +687,7 @@ test_search(struct listbox_item *item, void *data_, int *offset)
} }
if (title) { if (title) {
ctx->found = (strcasestr(title, ctx->title) ctx->found = (strcasestr((const char *)title, (const char *)ctx->title)
!= NULL); != NULL);
mem_free(title); mem_free(title);
} }

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; struct cache_entry *cached = item->udata;
if (c_strcasestr(struri(cached->uri), text) if (c_strcasestr((const char *)struri(cached->uri), (const char *)text)
|| (cached->head && c_strcasestr(cached->head, text))) || (cached->head && c_strcasestr((const char *)cached->head, (const char *)text)))
return LISTBOX_MATCH_OK; return LISTBOX_MATCH_OK;
return LISTBOX_MATCH_NO; return LISTBOX_MATCH_NO;

View File

@ -209,8 +209,8 @@ match_option(struct listbox_item *item, struct terminal *term,
if (option->type == OPT_TREE) if (option->type == OPT_TREE)
return LISTBOX_MATCH_IMPOSSIBLE; return LISTBOX_MATCH_IMPOSSIBLE;
if (strcasestr(option->name, text) if (strcasestr((const char *)option->name, (const char *)text)
|| (option->capt && strcasestr(_(option->capt, term), text))) || (option->capt && strcasestr((const char *)_(option->capt, term), (const char *)text)))
return LISTBOX_MATCH_OK; return LISTBOX_MATCH_OK;
return LISTBOX_MATCH_NO; return LISTBOX_MATCH_NO;
@ -709,7 +709,7 @@ match_keybinding(struct listbox_item *item, struct terminal *term,
desc = keybinding_text_toggle desc = keybinding_text_toggle
? action->str : _(action->desc, term); ? action->str : _(action->desc, term);
if ((desc && strcasestr(desc, text))) if ((desc && strcasestr((const char *)desc, (const char *)text)))
return LISTBOX_MATCH_OK; return LISTBOX_MATCH_OK;
return LISTBOX_MATCH_NO; return LISTBOX_MATCH_NO;

View File

@ -805,21 +805,21 @@ html_link_parse(struct html_context *html_context, unsigned char *a,
return 1; return 1;
} }
if (c_strcasestr(link->name, "icon") || if (c_strcasestr((const char *)link->name, "icon") ||
(link->content_type && c_strcasestr(link->content_type, "icon"))) { (link->content_type && c_strcasestr((const char *)link->content_type, "icon"))) {
link->type = LT_ICON; link->type = LT_ICON;
} else if (c_strcasestr(link->name, "alternate")) { } else if (c_strcasestr((const char *)link->name, "alternate")) {
link->type = LT_ALTERNATE; link->type = LT_ALTERNATE;
if (link->lang) if (link->lang)
link->type = LT_ALTERNATE_LANG; link->type = LT_ALTERNATE_LANG;
else if (c_strcasestr(link->name, "stylesheet") || else if (c_strcasestr((const char *)link->name, "stylesheet") ||
(link->content_type && c_strcasestr(link->content_type, "css"))) (link->content_type && c_strcasestr((const char *)link->content_type, "css")))
link->type = LT_ALTERNATE_STYLESHEET; link->type = LT_ALTERNATE_STYLESHEET;
else if (link->media) else if (link->media)
link->type = LT_ALTERNATE_MEDIA; link->type = LT_ALTERNATE_MEDIA;
} else if (link->content_type && c_strcasestr(link->content_type, "css")) { } else if (link->content_type && c_strcasestr((const char *)link->content_type, "css")) {
link->type = LT_STYLESHEET; link->type = LT_STYLESHEET;
} }

View File

@ -314,9 +314,9 @@ globhist_simple_search(unsigned char *search_url, unsigned char *search_title)
foreach (history_item, global_history.entries) { foreach (history_item, global_history.entries) {
/* Make matching entries visible, hide others. */ /* Make matching entries visible, hide others. */
if ((*search_title if ((*search_title
&& strcasestr(history_item->title, search_title)) && strcasestr((const char *)history_item->title, (const char *)search_title))
|| (*search_url || (*search_url
&& c_strcasestr(history_item->url, search_url))) { && c_strcasestr((const char *)history_item->url, (const char *)search_url))) {
history_item->box_item->visible = 1; history_item->box_item->visible = 1;
} else { } else {
history_item->box_item->visible = 0; history_item->box_item->visible = 0;

View File

@ -250,7 +250,7 @@ get_fragment_content_type(struct cache_entry *cached)
if (!sample) if (!sample)
return NULL; return NULL;
if (c_strcasestr(sample, "<html>")) if (c_strcasestr((const char *)sample, "<html>"))
ctype = stracpy("text/html"); ctype = stracpy("text/html");
mem_free(sample); mem_free(sample);

View File

@ -37,7 +37,7 @@ proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy)
skip_space(no_proxy); skip_space(no_proxy);
if (jumper) *jumper = '\0'; if (jumper) *jumper = '\0';
if (c_strcasestr(url, no_proxy)) { if (c_strcasestr((const char *)url, (const char *)no_proxy)) {
if (jumper) *jumper = ','; if (jumper) *jumper = ',';
if (slash) *slash = '/'; if (slash) *slash = '/';
return 1; return 1;

View File

@ -1194,7 +1194,7 @@ match_link_text(struct link *link, unsigned char *text, int textlen,
return -1; return -1;
matchpos = case_sensitive ? strstr(match, text) matchpos = case_sensitive ? strstr(match, text)
: strcasestr(match, text); : strcasestr((const char *)match, (const char *)text);
if (matchpos) { if (matchpos) {
return matchpos - match; return matchpos - match;