From 1b06539694889a3261f1d245ef8618960397ac59 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Wed, 20 Apr 2016 20:11:08 +0200 Subject: [PATCH] Explicit cast to (const char *) in strcasestr for C++ --- src/bfu/menu.c | 2 +- src/bookmarks/dialogs.c | 4 ++-- src/cache/dialogs.c | 4 ++-- src/config/dialogs.c | 6 +++--- src/document/html/parser/link.c | 12 ++++++------ src/globhist/globhist.c | 4 ++-- src/mime/mime.c | 2 +- src/protocol/proxy.c | 2 +- src/viewer/text/search.c | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bfu/menu.c b/src/bfu/menu.c index ac1a4d91..7e76fd91 100644 --- a/src/bfu/menu.c +++ b/src/bfu/menu.c @@ -799,7 +799,7 @@ search_menu_item(struct menu_item *item, unsigned char *buffer, if (match) memmove(match, match + 1, strlen(match)); - match = strcasestr(text, buffer); + match = strcasestr((const char *)text, (const char *)buffer); mem_free(text); return !!match; diff --git a/src/bookmarks/dialogs.c b/src/bookmarks/dialogs.c index 93d93b83..642505f0 100644 --- a/src/bookmarks/dialogs.c +++ b/src/bookmarks/dialogs.c @@ -663,7 +663,7 @@ test_search(struct listbox_item *item, void *data_, int *offset) 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) { /* The comparison of bookmark titles should * be case-insensitive and locale-sensitive @@ -687,7 +687,7 @@ test_search(struct listbox_item *item, void *data_, int *offset) } if (title) { - ctx->found = (strcasestr(title, ctx->title) + ctx->found = (strcasestr((const char *)title, (const char *)ctx->title) != NULL); mem_free(title); } diff --git a/src/cache/dialogs.c b/src/cache/dialogs.c index ec253308..3d9f683d 100644 --- a/src/cache/dialogs.c +++ b/src/cache/dialogs.c @@ -193,8 +193,8 @@ match_cache_entry(struct listbox_item *item, struct terminal *term, { struct cache_entry *cached = item->udata; - if (c_strcasestr(struri(cached->uri), text) - || (cached->head && c_strcasestr(cached->head, text))) + if (c_strcasestr((const char *)struri(cached->uri), (const char *)text) + || (cached->head && c_strcasestr((const char *)cached->head, (const char *)text))) return LISTBOX_MATCH_OK; return LISTBOX_MATCH_NO; diff --git a/src/config/dialogs.c b/src/config/dialogs.c index f7384d53..afb21ed7 100644 --- a/src/config/dialogs.c +++ b/src/config/dialogs.c @@ -209,8 +209,8 @@ match_option(struct listbox_item *item, struct terminal *term, if (option->type == OPT_TREE) return LISTBOX_MATCH_IMPOSSIBLE; - if (strcasestr(option->name, text) - || (option->capt && strcasestr(_(option->capt, term), text))) + if (strcasestr((const char *)option->name, (const char *)text) + || (option->capt && strcasestr((const char *)_(option->capt, term), (const char *)text))) return LISTBOX_MATCH_OK; return LISTBOX_MATCH_NO; @@ -709,7 +709,7 @@ match_keybinding(struct listbox_item *item, struct terminal *term, desc = keybinding_text_toggle ? 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_NO; diff --git a/src/document/html/parser/link.c b/src/document/html/parser/link.c index 527a3c83..4c14a4c1 100644 --- a/src/document/html/parser/link.c +++ b/src/document/html/parser/link.c @@ -805,21 +805,21 @@ html_link_parse(struct html_context *html_context, unsigned char *a, return 1; } - if (c_strcasestr(link->name, "icon") || - (link->content_type && c_strcasestr(link->content_type, "icon"))) { + if (c_strcasestr((const char *)link->name, "icon") || + (link->content_type && c_strcasestr((const char *)link->content_type, "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; if (link->lang) link->type = LT_ALTERNATE_LANG; - else if (c_strcasestr(link->name, "stylesheet") || - (link->content_type && c_strcasestr(link->content_type, "css"))) + else if (c_strcasestr((const char *)link->name, "stylesheet") || + (link->content_type && c_strcasestr((const char *)link->content_type, "css"))) link->type = LT_ALTERNATE_STYLESHEET; else if (link->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; } diff --git a/src/globhist/globhist.c b/src/globhist/globhist.c index f33d492e..6bf73964 100644 --- a/src/globhist/globhist.c +++ b/src/globhist/globhist.c @@ -314,9 +314,9 @@ globhist_simple_search(unsigned char *search_url, unsigned char *search_title) foreach (history_item, global_history.entries) { /* Make matching entries visible, hide others. */ if ((*search_title - && strcasestr(history_item->title, search_title)) + && strcasestr((const char *)history_item->title, (const char *)search_title)) || (*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; } else { history_item->box_item->visible = 0; diff --git a/src/mime/mime.c b/src/mime/mime.c index 6cb784b5..f808ba86 100644 --- a/src/mime/mime.c +++ b/src/mime/mime.c @@ -250,7 +250,7 @@ get_fragment_content_type(struct cache_entry *cached) if (!sample) return NULL; - if (c_strcasestr(sample, "")) + if (c_strcasestr((const char *)sample, "")) ctype = stracpy("text/html"); mem_free(sample); diff --git a/src/protocol/proxy.c b/src/protocol/proxy.c index c9adff40..96e4f0e7 100644 --- a/src/protocol/proxy.c +++ b/src/protocol/proxy.c @@ -37,7 +37,7 @@ proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy) skip_space(no_proxy); if (jumper) *jumper = '\0'; - if (c_strcasestr(url, no_proxy)) { + if (c_strcasestr((const char *)url, (const char *)no_proxy)) { if (jumper) *jumper = ','; if (slash) *slash = '/'; return 1; diff --git a/src/viewer/text/search.c b/src/viewer/text/search.c index b09609fe..5cc38e10 100644 --- a/src/viewer/text/search.c +++ b/src/viewer/text/search.c @@ -1194,7 +1194,7 @@ match_link_text(struct link *link, unsigned char *text, int textlen, return -1; matchpos = case_sensitive ? strstr(match, text) - : strcasestr(match, text); + : strcasestr((const char *)match, (const char *)text); if (matchpos) { return matchpos - match; -- 2.11.4.GIT