1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-18 15:24:36 -04:00

Explicit cast to (const char *) for strchr function (C++)

This commit is contained in:
Witold Filipczyk 2016-04-20 19:43:37 +02:00
parent 89387e3679
commit 52d6f37c8e
44 changed files with 102 additions and 102 deletions

View File

@ -349,7 +349,7 @@ select_button_by_key(struct dialog_data *dlg_data)
#ifdef CONFIG_UTF8
hk_char = cp_to_unicode(codepage, &hk_ptr,
strchr(hk_ptr, '\0'));
strchr((const char *)hk_ptr, '\0'));
/* hk_char can be UCS_NO_CHAR only if the text of the
* widget is not in the expected codepage. */
assert(hk_char != UCS_NO_CHAR);

View File

@ -25,7 +25,7 @@ static inline int
find_hotkey_pos(unsigned char *text)
{
if (text && *text) {
unsigned char *p = strchr(text, '~');
unsigned char *p = strchr((const char *)text, '~');
if (p) return (int) (p - text) + 1;
}
@ -178,7 +178,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
/* Compare @key to the character to which @text points. */
#ifdef CONFIG_UTF8
items_hotkey = cp_to_unicode(codepage, &text,
strchr(text, '\0'));
strchr((const char *)text, '\0'));
/* items_hotkey can be UCS_NO_CHAR only if the text of
* the menu item is not in the expected codepage. */
assert(items_hotkey != UCS_NO_CHAR);

View File

@ -477,7 +477,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
#ifdef CONFIG_UTF8
if (term->utf8_cp) {
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos;
unsigned char *end = strchr(next, '\0');
unsigned char *end = strchr((const char *)next, '\0');
utf8_to_unicode(&next, end);
widget_data->info.field.cpos = (int)(next - widget_data->cdata);

View File

@ -456,7 +456,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
#ifdef CONFIG_UTF8
utf8:
end = strchr(text, '\0');
end = strchr((const char *)text, '\0');
text2 = text;
for (x = 0; x - !!hk_state < w && *text2; x++) {
unicode_val_T data;
@ -795,7 +795,7 @@ search_menu_item(struct menu_item *item, unsigned char *buffer,
text = stracpy(text);
if (!text) return 0;
match = strchr(text, '~');
match = strchr((const char *)text, '~');
if (match)
memmove(match, match + 1, strlen(match));

View File

@ -47,7 +47,7 @@ read_bookmarks_default(FILE *f)
/* Load URL. */
url = strchr(in_buffer, '\t');
url = strchr((const char *)in_buffer, '\t');
/* If separator is not found, or title is empty or too long,
* skip that line. */
@ -59,7 +59,7 @@ read_bookmarks_default(FILE *f)
/* Load depth. */
depth_str = strchr(url, '\t');
depth_str = strchr((const char *)url, '\t');
if (depth_str && depth_str - url > MAX_STR_LEN - 1)
continue;
@ -71,7 +71,7 @@ read_bookmarks_default(FILE *f)
/* Load flags. */
flags = strchr(depth_str, '\t');
flags = strchr((const char *)depth_str, '\t');
if (flags) {
*flags = '\0';
flags++;
@ -82,7 +82,7 @@ read_bookmarks_default(FILE *f)
/* Load EOLN. */
line_end = strchr(flags ? flags : depth_str, '\n');
line_end = strchr((const char *)(flags ? flags : depth_str), '\n');
if (!line_end)
continue;
*line_end = '\0';

2
src/cache/cache.c vendored
View File

@ -754,7 +754,7 @@ redirect_cache(struct cache_entry *cached, unsigned char *location,
/* To be certain we don't append post data twice in some
* conditions... --Zas */
assert(!strchr(uristring, POST_CHAR));
assert(!strchr((const char *)uristring, POST_CHAR));
add_to_strn(&uristring, cached->uri->post - 1);
}

View File

@ -70,8 +70,8 @@ parse_options_(int argc, unsigned char *argv[], struct option *opt,
/* Substitute '-' by '_'. This helps
* compatibility with that very wicked browser
* called 'lynx'. */
for (pos = strchr(oname, '_'); pos;
pos = strchr(pos, '_'))
for (pos = strchr((const char *)oname, '_'); pos;
pos = strchr((const char *)pos, '_'))
*pos = '-';
option = get_opt_rec(opt, oname);
oname--;
@ -272,7 +272,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
if (*start == '"') {
end = ++start;
while ((end = strchr(end, '"'))) {
while ((end = strchr((const char *)end, '"'))) {
/* Treat "" inside quoted arg as ". */
if (end[1] != '"')
break;
@ -300,7 +300,7 @@ remote_cmd(struct option *o, unsigned char ***argv, int *argc)
*start = 0;
} else {
end = strchr(start, ',');
end = strchr((const char *)start, ',');
if (!end) {
end = start + strlen(start);
arg = end;
@ -646,7 +646,7 @@ print_short_help(void)
static unsigned char *
printhelp_cmd(struct option *option, unsigned char ***argv, int *argc)
{
unsigned char *lineend = strchr(full_static_version, '\n');
unsigned char *lineend = strchr((const char *)full_static_version, '\n');
if (lineend) *lineend = '\0';

View File

@ -728,10 +728,10 @@ load_cookies(void) {
/* First find all members. */
for (member = NAME; member < MEMBERS; member++, q = ++p) {
p = strchr(q, '\t');
p = strchr((const char *)q, '\t');
if (!p) {
if (member + 1 != MEMBERS) break; /* last field ? */
p = strchr(q, '\n');
p = strchr((const char *)q, '\n');
if (!p) break;
}

View File

@ -434,7 +434,7 @@ extract_rows_or_cols_values(unsigned char *str, int max_value, int pixels_per_ch
values[values_count++] = val;
/* Check for next field if any. */
tmp_str = strchr(str, ',');
tmp_str = strchr((const char *)str, ',');
if (!tmp_str) break; /* It was the last field. */
str = tmp_str + 1;

View File

@ -94,11 +94,11 @@ html_parse_meta_refresh(const unsigned char *content,
if (*url_begin == '"' || *url_begin == '\'') {
unsigned char quote = *url_begin++;
url_end = strchr(url_begin, quote);
url_end = strchr((const char *)url_begin, quote);
if (url_end == NULL)
url_end = strchr(url_begin, '\0');
url_end = strchr((const char *)url_begin, '\0');
} else {
url_end = strchr(url_begin, '\0');
url_end = strchr((const char *)url_begin, '\0');
}
/* In any case, trim all spaces from the end of the URL. */

View File

@ -96,12 +96,12 @@ html_form(struct html_context *html_context, unsigned char *a,
form->action = get_uri_string(html_context->base_href, components);
/* No action URI should contain post data */
assert(!form->action || !strchr(form->action, POST_CHAR));
assert(!form->action || !strchr((const char *)form->action, POST_CHAR));
/* GET method URIs should not have '?'. */
assert(!form->action
|| form->method != FORM_METHOD_GET
|| !strchr(form->action, '?'));
|| !strchr((const char *)form->action, '?'));
}
al = get_target(html_context->options, a);

View File

@ -332,7 +332,7 @@ parse_dom_config(unsigned char *flaglist, unsigned char separator)
enum dom_config_flag flags = 0;
while (flaglist) {
unsigned char *end = separator ? strchr(flaglist, separator) : NULL;
unsigned char *end = separator ? strchr((const char *)flaglist, separator) : NULL;
int length = end ? end - flaglist : strlen(flaglist);
struct dom_string name = INIT_DOM_STRING(flaglist, length);

View File

@ -113,7 +113,7 @@ load_formhist_from_file(void)
if (tmp[0] == '\n' && !tmp[1]) continue;
p = strchr(tmp, '\t');
p = strchr((const char *)tmp, '\t');
if (p) {
*p = '\0';
++p;
@ -149,13 +149,13 @@ load_formhist_from_file(void)
/* Type */
type = tmp;
p = strchr(type, '\t');
p = strchr((const char *)type, '\t');
if (!p) goto fail;
*p = '\0';
/* Name */
name = ++p;
p = strchr(name, '\t');
p = strchr((const char *)name, '\t');
if (!p) {
/* Compatibility with previous file formats.
* REMOVE AT SOME TIME --Zas */
@ -176,7 +176,7 @@ load_formhist_from_file(void)
/* Value */
value = ++p;
cont:
p = strchr(value, '\n');
p = strchr((const char *)value, '\n');
if (!p) goto fail;
*p = '\0';

View File

@ -353,15 +353,15 @@ read_global_history(void)
while (fgets(in_buffer, sizeof(in_buffer), f)) {
unsigned char *url, *last_visit, *eol;
url = strchr(title, '\t');
url = strchr((const char *)title, '\t');
if (!url) continue;
*url++ = '\0'; /* Now url points to the character after \t. */
last_visit = strchr(url, '\t');
last_visit = strchr((const char *)url, '\t');
if (!last_visit) continue;
*last_visit++ = '\0';
eol = strchr(last_visit, '\n');
eol = strchr((const char *)last_visit, '\n');
if (!eol) continue;
*eol = '\0'; /* Drop ending '\n'. */

View File

@ -296,7 +296,7 @@ int
strlen_utf8(unsigned char **str)
{
unsigned char *s = *str;
unsigned char *end = strchr(s, '\0');
unsigned char *end = strchr((const char *)s, '\0');
int x;
int len;
@ -334,7 +334,7 @@ utf8_char2cells(unsigned char *utf8_char, unsigned char *end)
unicode_val_T u;
if (end == NULL)
end = strchr(utf8_char, '\0');
end = strchr((const char *)utf8_char, '\0');
if(!utf8_char || !end)
return -1;
@ -352,7 +352,7 @@ utf8_ptr2cells(unsigned char *string, unsigned char *end)
int charlen, cell, cells = 0;
if (end == NULL)
end = strchr(string, '\0');
end = strchr((const char *)string, '\0');
if(!string || !end)
return -1;
@ -380,7 +380,7 @@ utf8_ptr2chars(unsigned char *string, unsigned char *end)
int charlen, chars = 0;
if (end == NULL)
end = strchr(string, '\0');
end = strchr((const char *)string, '\0');
if(!string || !end)
return -1;
@ -409,7 +409,7 @@ utf8_cells2bytes(unsigned char *string, int max_cells, unsigned char *end)
assert(max_cells>=0);
if (end == NULL)
end = strchr(string, '\0');
end = strchr((const char *)string, '\0');
if(!string || !end)
return -1;
@ -455,7 +455,7 @@ utf8_step_forward(unsigned char *string, unsigned char *end,
assert(max >= 0);
if_assert_failed goto invalid_arg;
if (end == NULL)
end = strchr(string, '\0');
end = strchr((const char *)string, '\0');
switch (way) {
case UTF8_STEP_CHARACTERS:

View File

@ -110,11 +110,11 @@ extern int errno;
/* Win32, OS/2, DOS */
#define HAS_DEVICE(P) (isasciialpha((P)[0]) && (P)[1] == ':')
#define IS_ABSOLUTE_PATH(P) (dir_sep((P)[0]) || HAS_DEVICE (P))
#define IS_PATH_WITH_DIR(P) (strchr (P, '/') || strchr (P, '\\') || HAS_DEVICE (P))
#define IS_PATH_WITH_DIR(P) (strchr ((const char *)(P), '/') || strchr ((const char *)(P), '\\') || HAS_DEVICE (P))
#else
/* Unix */
#define IS_ABSOLUTE_PATH(P) dir_sep((P)[0])
#define IS_PATH_WITH_DIR(P) strchr (P, '/')
#define IS_PATH_WITH_DIR(P) strchr ((const char *)(P), '/')
#endif
/* XPG3 defines the result of `setlocale (category, NULL)' as:
@ -401,7 +401,7 @@ dcigettext__(const unsigned char *domainname, const unsigned char *msgid1, const
: n == 1 ? (unsigned char *) msgid1 : (unsigned char *) msgid2);
}
stpcpy(stpcpy(strchr(dirname, '\0'), "/"), binding->dirname);
stpcpy(stpcpy(strchr((const char *)dirname, '\0'), "/"), binding->dirname);
}
/* Now determine the symbolic name of CATEGORY and its value. */
@ -781,7 +781,7 @@ plural_lookup(struct loaded_l10nfile *domain, unsigned long int n,
/* Skip INDEX strings at TRANSLATION. */
p = translation;
while (indexx-- > 0) {
p = strchr(p, '\0');
p = strchr((const char *)p, '\0');
/* And skip over the NUL byte. */
p++;

View File

@ -77,7 +77,7 @@ _nl_explode_name(unsigned char *name, const unsigned char **language, const unsi
if (*language == cp)
/* This does not make sense: language has to be specified. Use
this entry as it is without exploding. Perhaps it is an alias. */
cp = strchr(*language, '\0');
cp = strchr((const char *)*language, '\0');
else if (cp[0] == '_') {
/* Next is the territory. */
cp[0] = '\0';

View File

@ -119,7 +119,7 @@ argz_next__(unsigned char *argz, size_t argz_len, const unsigned char *entry)
{
if (entry) {
if (entry < argz + argz_len)
entry = strchr(entry, '\0') + 1;
entry = strchr((const char *)entry, '\0') + 1;
return entry >= argz + argz_len ? NULL : (unsigned char *) entry;
} else if (argz_len > 0)

View File

@ -81,15 +81,15 @@ iso639_to_language(unsigned char *iso639)
/* The environment variable transformation. */
p = strchr(l, '.');
p = strchr((const char *)l, '.');
if (p)
*p = '\0';
p = strchr(l, '_');
p = strchr((const char *)l, '_');
if (p)
*p = '-';
else
p = strchr(l, '-');
p = strchr((const char *)l, '-');
/* Exact match. */
@ -208,7 +208,7 @@ set_language(int language)
}
if (LANGUAGE) {
strcpy(LANGUAGE, language_to_iso639(language));
p = strchr(LANGUAGE, '-');
p = strchr((const char *)LANGUAGE, '-');
if (p) {
*p = '_';
}

View File

@ -154,7 +154,7 @@ read_alias_file(const unsigned char *fname, int fname_len)
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
if (strchr(buf, '\n') == NULL) {
if (strchr((const char *)buf, '\n') == NULL) {
unsigned char altbuf[BUFSIZ];
do
@ -162,7 +162,7 @@ read_alias_file(const unsigned char *fname, int fname_len)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
break;
while (strchr(altbuf, '\n') == NULL);
while (strchr((const char *)altbuf, '\n') == NULL);
}
cp = buf;

View File

@ -70,7 +70,7 @@ wrap_string(struct string *string, int start_at, int maxlen)
if (maxlen <= 0) return;
pos = start_pos = &string->source[start_at];
while ((pos = strchr(pos, ' '))) {
while ((pos = strchr((const char *)pos, ' '))) {
int len = pos - start_pos;
if (len < maxlen) {

View File

@ -160,7 +160,7 @@ get_mime_type_option(unsigned char *type)
if (add_optname_to_string(&name, type, strlen(type))) {
/* Search for end of the base type. */
unsigned char *pos = strchr(name.source, '/');
unsigned char *pos = strchr((const char *)name.source, '/');
if (pos) {
*pos = '.';

View File

@ -232,7 +232,7 @@ get_mailcap_field(unsigned char **next)
if (*fieldend == ';')
fieldend++;
fieldend = strchr(fieldend, ';');
fieldend = strchr((const char *)fieldend, ';');
} while (fieldend && *(fieldend-1) == '\\');
if (fieldend) {
@ -359,7 +359,7 @@ parse_mailcap_file(unsigned char *filename, unsigned int priority)
continue;
}
basetypeend = strchr(type, '/');
basetypeend = strchr((const char *)type, '/');
typelen = strlen(type);
if (!basetypeend) {
@ -609,7 +609,7 @@ get_mailcap_entry(unsigned char *type)
/* The type lookup has either failed or we need to check
* the priorities so get the wild card handler */
struct mailcap_entry *wildcard = NULL;
unsigned char *wildpos = strchr(type, '/');
unsigned char *wildpos = strchr((const char *)type, '/');
if (wildpos) {
int wildlen = wildpos - type + 1; /* include '/' */

View File

@ -141,7 +141,7 @@ parse_mimetypes_file(unsigned char *filename)
unsigned char *token;
/* Weed out any comments */
token = strchr(line, '#');
token = strchr((const char *)line, '#');
if (token)
*token = '\0';
@ -155,7 +155,7 @@ parse_mimetypes_file(unsigned char *filename)
*token++ = '\0';
/* Check if malformed content type */
if (!strchr(ctype, '/')) continue;
if (!strchr((const char *)ctype, '/')) continue;
parse_mimetypes_extensions(token, ctype);
}
@ -260,7 +260,7 @@ get_content_type_mimetypes(unsigned char *extension)
}
/* Try to trim the extension from the left. */
trimmed = strchr(extension, '.');
trimmed = strchr((const char *)extension, '.');
if (!trimmed)
break;

View File

@ -198,7 +198,7 @@ get_cache_header_content_type(struct cache_entry *cached)
ctype = parse_header(cached->head, "Content-Type", NULL);
if (ctype) {
unsigned char *end = strchr(ctype, ';');
unsigned char *end = strchr((const char *)ctype, ';');
int ctypelen;
if (end) *end = '\0';

View File

@ -296,7 +296,7 @@ make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent,
if (!init_string(&uri_string)) goto out;
if (!add_format_to_string(&uri_string,
#ifdef CONFIG_IPV6
strchr(peer_info->ip, ':') ?
strchr((const char *)peer_info->ip, ':') ?
"bittorrent-peer://[%s]:%u/" :
#endif
"bittorrent-peer://%s:%u/",

View File

@ -122,7 +122,7 @@ init_directory_listing(struct string *page, struct uri *uri)
const unsigned char *pslash = slash;
const unsigned char sep = local ? CHAR_DIR_SEP : '/';
while ((slash = strchr(slash, sep)) != NULL) {
while ((slash = strchr((const char *)slash, sep)) != NULL) {
done_string(&decoded);
if (!init_string(&decoded)
|| !add_bytes_to_string(&decoded, pslash, slash - pslash))

View File

@ -116,7 +116,7 @@ send_post_data(struct connection *conn)
unsigned char *postend;
struct connection_state error;
postend = strchr(post, '\n');
postend = strchr((const char *)post, '\n');
if (postend) post = postend + 1;
if (!open_http_post(&http->post, post, &error))
@ -148,7 +148,7 @@ set_vars(struct connection *conn, unsigned char *script)
if (res) return -1;
if (post) {
unsigned char *postend = strchr(post, '\n');
unsigned char *postend = strchr((const char *)post, '\n');
unsigned char buf[16];
if (postend) {

View File

@ -44,7 +44,7 @@ main(int argc, char *argv[])
while (*response) {
unsigned char *start = response;
response = strchr(response, '\n');
response = strchr((const char *)response, '\n');
if (!response) {
response = start + strlen(start);
} else {

View File

@ -831,7 +831,7 @@ static void
send_it_line_by_line(struct connection *conn, struct string *cmd)
{
struct ftp_connection_info *ftp = conn->info;
unsigned char *nl = strchr(ftp->cmd_buffer, '\n');
unsigned char *nl = strchr((const char *)ftp->cmd_buffer, '\n');
if (!nl) {
add_to_string(cmd, ftp->cmd_buffer);

View File

@ -414,7 +414,7 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line)
}
if (*name) {
selector = strchr(name, ASCII_TAB);
selector = strchr((const char *)name, ASCII_TAB);
if (selector) {
/* Terminate name */
*selector++ = '\0';
@ -428,13 +428,13 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line)
entity = *selector;
}
host = selector ? strchr(selector, ASCII_TAB) : NULL;
host = selector ? strchr((const char *)selector, ASCII_TAB) : NULL;
if (host) {
/* Terminate selector */
*host++ = '\0';
}
port = host ? strchr(host, ASCII_TAB) : NULL;
port = host ? strchr((const char *)host, ASCII_TAB) : NULL;
if (port) {
unsigned char *end;
int portno;

View File

@ -247,7 +247,7 @@ parse_header_param(unsigned char *str, unsigned char *name, unsigned char **ret)
namelen = strlen(name);
do {
p = strchr(p, ';');
p = strchr((const char *)p, ';');
if (!p) return HEADER_PARAM_NOT_FOUND;
while (*p && (*p == ';' || *p <= ' ')) p++;

View File

@ -998,7 +998,7 @@ http_send_header(struct socket *socket)
/* We search for first '\n' in uri->post to get content type
* as set by get_form_uri(). This '\n' is dropped if any
* and replaced by correct '\r\n' termination here. */
unsigned char *postend = strchr(uri->post, '\n');
unsigned char *postend = strchr((const char *)uri->post, '\n');
struct connection_state error;
if (postend) {

View File

@ -104,9 +104,9 @@ open_http_post(struct http_post *http_post, const unsigned char *post_data,
struct http_post_file *new_files;
unsigned char *filename;
begin = strchr(end, FILE_CHAR);
begin = strchr((const char *)end, FILE_CHAR);
if (!begin) break;
end = strchr(begin + 1, FILE_CHAR);
end = strchr((const char *)(begin + 1), FILE_CHAR);
if (!end) break;
filename = memacpy(begin + 1, end - begin - 1); /* adds '\0' */
if (!filename) {
@ -160,14 +160,14 @@ read_http_post_inline(struct http_post *http_post,
struct connection_state *error)
{
const unsigned char *post = http_post->post_data;
const unsigned char *end = strchr(post, FILE_CHAR);
const unsigned char *end = strchr((const char *)post, FILE_CHAR);
int total = 0;
assert(http_post->post_fd < 0);
if_assert_failed { *error = connection_state(S_INTERNAL); return -1; }
if (!end)
end = strchr(post, '\0');
end = strchr((const char *)post, '\0');
while (post < end && total < max) {
int h1, h2;
@ -189,7 +189,7 @@ read_http_post_inline(struct http_post *http_post,
}
http_post->file_read = 0;
end = strchr(post + 1, FILE_CHAR);
end = strchr((const char *)(post + 1), FILE_CHAR);
assert(end);
http_post->post_fd = open(http_post->files[http_post->file_index].name,
O_RDONLY);

View File

@ -288,7 +288,7 @@ add_header_to_string(struct string *str, unsigned char *header)
* ep : "=?ISO-8859-1?Q?Foo=FCbar?= baz"
*/
end += 2;
cp = strchr(end, '?');
cp = strchr((const char *)end, '?');
if (!cp)
break;
@ -423,7 +423,7 @@ add_nntp_html_line(struct string *html, struct connection *conn,
{
unsigned char *field = line;
line = strchr(line, '\t');
line = strchr((const char *)line, '\t');
if (!line)
field = "";
else
@ -432,7 +432,7 @@ add_nntp_html_line(struct string *html, struct connection *conn,
field, struri(conn->uri), field);
field = line;
line = strchr(line, '\t');
line = strchr((const char *)line, '\t');
if (line)
*line++ = 0;
@ -441,7 +441,7 @@ add_nntp_html_line(struct string *html, struct connection *conn,
if (line) {
field = line;
line = strchr(line, '\t');
line = strchr((const char *)line, '\t');
if (line)
*line++ = 0;

View File

@ -27,12 +27,12 @@
static int
proxy_probe_no_proxy(unsigned char *url, unsigned char *no_proxy)
{
unsigned char *slash = strchr(url, '/');
unsigned char *slash = strchr((const char *)url, '/');
if (slash) *slash = '\0';
while (no_proxy && *no_proxy) {
unsigned char *jumper = strchr(no_proxy, ',');
unsigned char *jumper = strchr((const char *)no_proxy, ',');
skip_space(no_proxy);
if (jumper) *jumper = '\0';
@ -168,7 +168,7 @@ get_proxy_worker(struct uri *uri, unsigned char *proxy,
if (protocol_proxy && *protocol_proxy) {
unsigned char *no_proxy;
unsigned char *slash = strchr(protocol_proxy, '/');
unsigned char *slash = strchr((const char *)protocol_proxy, '/');
if (slash) *slash = 0;

View File

@ -325,9 +325,9 @@ goto_url_hook(va_list ap, void *data)
uu = get_uri_rewrite_prefix(URI_REWRITE_DUMB, *url);
if (!uu
&& !strchr(*url, ':')
&& !strchr(*url, '.')
&& !strchr(*url, '/')) {
&& !strchr((const char *)*url, ':')
&& !strchr((const char *)*url, '.')
&& !strchr((const char *)*url, '/')) {
uu = get_opt_str("protocol.rewrite.default_template", NULL);
if (uu && *uu) {
arg = *url;

View File

@ -289,9 +289,9 @@ parse_uri(struct uri *uri, unsigned char *uristring)
#ifdef CONFIG_IPV6
/* Get brackets enclosing IPv6 address */
lbracket = strchr(prefix_end, '[');
lbracket = strchr((const char *)prefix_end, '[');
if (lbracket) {
rbracket = strchr(lbracket, ']');
rbracket = strchr((const char *)lbracket, ']');
/* [address] is handled only inside of hostname part (surprisingly). */
if (rbracket && rbracket < prefix_end + strcspn(prefix_end, "/"))
uri->ipv6 = 1;
@ -313,7 +313,7 @@ parse_uri(struct uri *uri, unsigned char *uristring)
while (strcspn(host_end + 1, "@") < strcspn(host_end + 1, "/?"))
host_end = host_end + 1 + strcspn(host_end + 1, "@");
user_end = strchr(prefix_end, ':');
user_end = strchr((const char *)prefix_end, ':');
if (!user_end || user_end > host_end) {
uri->user = prefix_end;
@ -1022,7 +1022,7 @@ find_uri_protocol(unsigned char *newurl)
ch = newurl + strcspn(newurl, ".:/@");
if (*ch == '@'
|| (*ch == ':' && *newurl != '[' && strchr(newurl, '@'))
|| (*ch == ':' && *newurl != '[' && strchr((const char *)newurl, '@'))
|| !c_strncasecmp(newurl, "ftp.", 4)) {
/* Contains user/password/ftp-hostname */
return PROTOCOL_FTP;
@ -1033,8 +1033,8 @@ find_uri_protocol(unsigned char *newurl)
unsigned char *bracket2, *colon2;
ch++;
bracket2 = strchr(ch, ']');
colon2 = strchr(ch, ':');
bracket2 = strchr((const char *)ch, ']');
colon2 = strchr((const char *)ch, ':');
if (bracket2 && colon2 && bracket2 > colon2)
return PROTOCOL_HTTP;
#endif

View File

@ -234,7 +234,7 @@ save_form_data_to_file(struct uri *uri)
if (!uri->post) return filename;
/* Jump the content type */
formdata = strchr(uri->post, '\n');
formdata = strchr((const char *)uri->post, '\n');
formdata = formdata ? formdata + 1 : uri->post;
len = strlen(formdata);
if (len == 0) return filename;

View File

@ -90,7 +90,7 @@ erb_report_error(struct session *ses, int error)
snprintf(buff, MAX_STR_LEN, "%s: %s",
RSTRING(epath)->ptr, RSTRING(einfo)->ptr);
p = strchr(buff, '\n');
p = strchr((const char *)buff, '\n');
if (p) *p = '\0';
msg = buff;
}
@ -119,7 +119,7 @@ erb_module_message(VALUE self, VALUE str)
message = memacpy(RSTRING(str)->ptr, RSTRING(str)->len);
if (!message) return Qnil;
line_end = strchr(message, '\n');
line_end = strchr((const char *)message, '\n');
if (line_end) *line_end = '\0';
term = get_default_terminal();

View File

@ -487,7 +487,7 @@ resize_terminal_from_str(unsigned char *text)
if_assert_failed return;
for (i = 0; i < NUMBERS; i++) {
unsigned char *p = strchr(text, ',');
unsigned char *p = strchr((const char *)text, ',');
if (p) {
*p++ = '\0';

View File

@ -205,7 +205,7 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno)
}
while (fgets(line + offset, *size - offset, file)) {
unsigned char *linepos = strchr(line + offset, '\n');
unsigned char *linepos = strchr((const char *)(line + offset), '\n');
if (!linepos) {
/* Test if the line buffer should be increase because

View File

@ -603,7 +603,7 @@ drew_char:
#ifdef CONFIG_UTF8
utf8_select:
text = s;
end = strchr(s, '\0');
end = strchr((const char *)s, '\0');
len = utf8_ptr2cells(text, end);
for (i = 0; i < link->npoints; i++) {
x = link->points[i].x + dx;
@ -1270,7 +1270,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
switch (form->method) {
case FORM_METHOD_GET:
{
unsigned char *pos = strchr(form->action, '#');
unsigned char *pos = strchr((const char *)form->action, '#');
if (pos) {
add_bytes_to_string(&go, form->action, pos - form->action);
@ -1278,7 +1278,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
add_to_string(&go, form->action);
}
if (strchr(go.source, '?'))
if (strchr((const char *)go.source, '?'))
add_char_to_string(&go, '&');
else
add_char_to_string(&go, '?');
@ -1519,7 +1519,7 @@ field_op(struct session *ses, struct document_view *doc_view,
}
if (utf8) {
unsigned char *text = fs->value + fs->state;
unsigned char *end = strchr(text, '\0');
unsigned char *end = strchr((const char *)text, '\0');
utf8_to_unicode(&text, end);
fs->state = (int)(text - fs->value);
@ -1766,7 +1766,7 @@ field_op(struct session *ses, struct document_view *doc_view,
break;
}
text = strchr(fs->value + fs->state, ASCII_LF);
text = strchr((const char *)(fs->value + fs->state), ASCII_LF);
if (!text) {
fs->value[fs->state] = '\0';
break;

View File

@ -1187,7 +1187,7 @@ do_op_right(struct form_state *fs, struct line_info *line, int current, int utf8
}
text = fs->value + fs->state;
end = strchr(text, '\0');
end = strchr((const char *)text, '\0');
old_state = fs->state;
utf8_to_unicode(&text, end);