mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-06 23:44:43 -04:00
Cast to (const char *) in strrchr calls
This commit is contained in:
parent
2e7a7a5ca3
commit
da15322705
@ -181,7 +181,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
|
||||
|
||||
/* We iteratively call get_opt_rec() each for path_elements-1, getting
|
||||
* appropriate tree for it and then resolving [path_elements]. */
|
||||
if ((sep = strrchr(name, '.'))) {
|
||||
if ((sep = strrchr((const char *)name, '.'))) {
|
||||
*sep = '\0';
|
||||
|
||||
tree = get_opt_rec(tree, name);
|
||||
|
@ -372,7 +372,7 @@ set_cookie(struct uri *uri, unsigned char *str)
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
path_end = strrchr(path, '/');
|
||||
path_end = strrchr((const char *)path, '/');
|
||||
if (path_end)
|
||||
path_end[1] = '\0';
|
||||
break;
|
||||
|
@ -539,7 +539,7 @@ html_embed(struct html_context *html_context, unsigned char *a,
|
||||
|
||||
/* If there is no extension we want to get the default mime/type
|
||||
* anyway? */
|
||||
extension = strrchr(object_src, '.');
|
||||
extension = strrchr((const char *)object_src, '.');
|
||||
if (!extension) extension = object_src;
|
||||
|
||||
type = get_extension_content_type(extension);
|
||||
|
@ -283,7 +283,7 @@ ecmascript_set_action(unsigned char **action, unsigned char *string)
|
||||
done_uri(uri);
|
||||
mem_free(string);
|
||||
} else { /* relative uri */
|
||||
unsigned char *last_slash = strrchr(*action, '/');
|
||||
unsigned char *last_slash = strrchr((const char *)*action, '/');
|
||||
unsigned char *new_action;
|
||||
|
||||
if (last_slash) *(last_slash + 1) = '\0';
|
||||
|
@ -216,7 +216,7 @@ _nl_free_domain_conv(struct loaded_domain *domain)
|
||||
static struct string *
|
||||
add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file)
|
||||
{
|
||||
unsigned char *slash = strrchr(program.path, '/');
|
||||
unsigned char *slash = strrchr((const char *)program.path, '/');
|
||||
size_t dirnamelen = (slash ? slash - program.path + 1 : 0);
|
||||
|
||||
/* Check if elinks is being run from the source tree. */
|
||||
|
@ -154,7 +154,7 @@ get_dyn_full_version(struct terminal *term, int more)
|
||||
|
||||
if (!more) {
|
||||
int start_at = 0;
|
||||
unsigned char *last_newline = strrchr(string.source, '\n');
|
||||
unsigned char *last_newline = strrchr((const char *)string.source, '\n');
|
||||
|
||||
if (last_newline) {
|
||||
start_at = last_newline - string.source + 1;
|
||||
|
@ -104,7 +104,7 @@ static inline unsigned char *
|
||||
check_extension_type(unsigned char *extension)
|
||||
{
|
||||
/* Trim the extension so only last .<extension> is used. */
|
||||
unsigned char *trimmed = strrchr(extension, '.');
|
||||
unsigned char *trimmed = strrchr((const char *)extension, '.');
|
||||
struct mime_handler *handler;
|
||||
unsigned char *content_type;
|
||||
|
||||
@ -133,7 +133,7 @@ check_encoding_type(unsigned char *extension)
|
||||
{
|
||||
enum stream_encoding encoding = guess_encoding(extension);
|
||||
const unsigned char *const *extension_list;
|
||||
unsigned char *last_extension = strrchr(extension, '.');
|
||||
unsigned char *last_extension = strrchr((const char *)extension, '.');
|
||||
|
||||
if (encoding == ENCODING_NONE || !last_extension)
|
||||
return NULL;
|
||||
|
@ -906,9 +906,9 @@ win32_strerror(int err)
|
||||
}
|
||||
|
||||
/* strip trailing '\r\n' or '\n'. */
|
||||
if ((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
|
||||
if ((p = strrchr((const char *)buf,'\n')) != NULL && (p - buf) >= 2)
|
||||
*p = '\0';
|
||||
if ((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
|
||||
if ((p = strrchr((const char *)buf,'\r')) != NULL && (p - buf) >= 1)
|
||||
*p = '\0';
|
||||
|
||||
return buf;
|
||||
|
@ -328,7 +328,7 @@ execute_cgi(struct connection *conn)
|
||||
return 1;
|
||||
}
|
||||
|
||||
last_slash = strrchr(script, '/');
|
||||
last_slash = strrchr((const char *)script, '/');
|
||||
if (last_slash++) {
|
||||
unsigned char storage;
|
||||
int res;
|
||||
|
@ -1009,7 +1009,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l,
|
||||
add_char_to_string(data, '"');
|
||||
|
||||
/* Add a Content-Type header if the type is configured */
|
||||
extension = strrchr(sv->value, '.');
|
||||
extension = strrchr((const char *)sv->value, '.');
|
||||
if (extension) {
|
||||
unsigned char *type = get_extension_content_type(extension);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user