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

[strstr] no cast

This commit is contained in:
Witold Filipczyk 2022-01-18 20:55:08 +01:00
parent e62b301657
commit de2a787900
13 changed files with 28 additions and 28 deletions

View File

@ -370,10 +370,10 @@ remote_cmd(struct option *o, char ***argv, int *argc)
if (remote_argc == 2) {
char *where = remote_argv[1];
if (strstr((const char *)where, "new-window")) {
if (strstr(where, "new-window")) {
remote_session_flags |= SES_REMOTE_NEW_WINDOW;
} else if (strstr((const char *)where, "new-tab")) {
} else if (strstr(where, "new-tab")) {
remote_session_flags |= SES_REMOTE_NEW_TAB;
} else {

View File

@ -350,18 +350,18 @@ check_head_for_cache_control(struct html_context *html_context,
* if we already set max age to date mentioned in Expires.
* --jonas */
if ((d = parse_header(head, "Pragma", NULL))) {
if (strstr((const char *)d, "no-cache")) {
if (strstr(d, "no-cache")) {
no_cache = 1;
}
mem_free(d);
}
if (!no_cache && (d = parse_header(head, "Cache-Control", NULL))) {
if (strstr((const char *)d, "no-cache") || strstr((const char *)d, "must-revalidate")) {
if (strstr(d, "no-cache") || strstr(d, "must-revalidate")) {
no_cache = 1;
} else {
char *pos = strstr((const char *)d, "max-age=");
char *pos = strstr(d, "max-age=");
assert(!no_cache);
@ -382,7 +382,7 @@ check_head_for_cache_control(struct html_context *html_context,
if (!no_cache && (d = parse_header(head, "Expires", NULL))) {
/* Convert date to seconds. */
if (strstr((const char *)d, "now")) {
if (strstr(d, "now")) {
timeval_T now;
timeval_now(&now);

View File

@ -143,7 +143,7 @@ _nl_init_domain_conv(struct loaded_l10nfile *domain_file,
#if HAVE_ICONV
const char *charsetstr;
charsetstr = strstr((const char *)nullentry, "charset=");
charsetstr = strstr(nullentry, "charset=");
if (charsetstr != NULL) {
size_t len;
char *charset;
@ -393,8 +393,8 @@ default:
const char *plural;
const char *nplurals;
plural = strstr((const char *)nullentry, "plural=");
nplurals = strstr((const char *)nullentry, "nplurals=");
plural = strstr(nullentry, "plural=");
nplurals = strstr(nullentry, "nplurals=");
if (plural == NULL || nplurals == NULL)
goto no_plural;
else {

View File

@ -824,16 +824,16 @@ main(int argc, char *argv[])
handler = get_mime_handler_mailcap(arg, 0);
if (!handler) continue;
if (strstr((const char *)format, "description"))
if (strstr(format, "description"))
printf("description: %s\n", handler->description);
if (strstr((const char *)format, "ask"))
if (strstr(format, "ask"))
printf("ask: %d\n", handler->ask);
if (strstr((const char *)format, "block"))
if (strstr(format, "block"))
printf("block: %d\n", handler->block);
if (strstr((const char *)format, "program"))
if (strstr(format, "program"))
printf("program: %s\n", handler->program);
} else {

View File

@ -600,7 +600,7 @@ create_bittorrent_path(char *path)
static void
remove_bittorrent_path(struct bittorrent_meta *meta, char *path)
{
char *root = strstr((const char *)path, (const char *)meta->name);
char *root = strstr(path, meta->name);
int pos;
assert(meta->type == BITTORRENT_MULTI_FILE);

View File

@ -892,7 +892,7 @@ get_filesize_from_RETR(char *data, int data_len, int *resume)
double size;
data[data_len - 1] = '\0';
kbytes = strstr((const char *)data, "kbytes");
kbytes = strstr(data, "kbytes");
data[data_len - 1] = tmp;
if (!kbytes) return -1;

View File

@ -403,7 +403,7 @@ encode_selector_string(struct string *buffer, char *selector)
/* Rather hackishly only convert slashes if there are
* two successive ones. */
while ((slashes = strstr((const char *)selector, "//"))) {
while ((slashes = strstr(selector, "//"))) {
*slashes = 0;
encode_uri_string(buffer, selector, -1, 0);
encode_uri_string(buffer, "//", 2, 1);

View File

@ -472,7 +472,7 @@ check_http_server_bugs(struct uri *uri, struct http_connection_info *http,
return 0;
for (s = buggy_servers; *s; s++) {
if (strstr((const char *)server, *s)) {
if (strstr(server, *s)) {
add_blacklist_entry(uri, SERVER_BLACKLIST_HTTP10);
break;
}
@ -1610,7 +1610,7 @@ again:
}
if ((d = parse_header(cached->head, "Pragma", NULL))) {
if (strstr((const char *)d, "no-cache")) {
if (strstr(d, "no-cache")) {
cached->cache_mode = CACHE_MODE_NEVER;
cached->expire = 0;
}
@ -1619,12 +1619,12 @@ again:
if (cached->cache_mode != CACHE_MODE_NEVER
&& (d = parse_header(cached->head, "Cache-Control", NULL))) {
if (strstr((const char *)d, "no-cache") || strstr((const char *)d, "must-revalidate")) {
if (strstr(d, "no-cache") || strstr(d, "must-revalidate")) {
cached->cache_mode = CACHE_MODE_NEVER;
cached->expire = 0;
} else {
char *pos = strstr((const char *)d, "max-age=");
char *pos = strstr(d, "max-age=");
assert(cached->cache_mode != CACHE_MODE_NEVER);

View File

@ -279,7 +279,7 @@ add_header_to_string(struct string *str, char *header)
{
char *end;
while ((end = strstr((const char *)header, "=?")) != NULL) {
while ((end = strstr(header, "=?")) != NULL) {
int encoding;
char *cp, *sp;
@ -304,7 +304,7 @@ add_header_to_string(struct string *str, char *header)
if (!encoding || cp[2] != '?')
break;
cp += 3;
end = strstr((const char *)(cp + 3), "?=");
end = strstr((cp + 3), "?=");
if (!end)
break;
if (encoding == 'b')

View File

@ -203,7 +203,7 @@ get_subject_from_query(char *query)
char *subject;
if (strncmp(query, "subject=", 8)) {
subject = strstr((const char *)query, "&subject=");
subject = strstr(query, "&subject=");
if (!subject) return NULL;
subject += 9;
} else {

View File

@ -229,10 +229,10 @@ elinks_log(char *msg, char *file, int line,
atexit(done_log);
}
if (log_files && !strstr((const char *)log_files, file))
if (log_files && !strstr(log_files, file))
return;
if (log_msg && !strstr((const char *)log_msg, msg))
if (log_msg && !strstr(log_msg, msg))
return;
va_start(params, fmt);

View File

@ -68,7 +68,7 @@ current_link_evhook(struct document_view *doc_view, enum script_event_hook_type
if (evhook->type != type) continue;
ret = evhook->src;
while ((ret = strstr((const char *)ret, "return ")))
while ((ret = strstr(ret, "return ")))
while (*ret != ' ') *ret++ = ' ';
{
struct string src = INIT_STRING(evhook->src, (int)strlen(evhook->src));

View File

@ -1446,8 +1446,8 @@ match_link_text(struct link *link, char *text, int textlen,
if (link_is_form(link) || textlen > strlen(match))
return -1;
matchpos = case_sensitive ? strstr((const char *)match, (const char *)text)
: strcasestr((const char *)match, (const char *)text);
matchpos = case_sensitive ? strstr(match, text)
: strcasestr(match, text);
if (matchpos) {
return matchpos - match;