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

[strrchr] Drop cast to const char *

This commit is contained in:
Witold Filipczyk 2022-01-18 20:42:29 +01:00
parent 7b77d84626
commit e62b301657
10 changed files with 12 additions and 12 deletions

View File

@ -187,7 +187,7 @@ get_opt_rec(struct option *tree, const char *name_)
/* We iteratively call get_opt_rec() each for path_elements-1, getting /* We iteratively call get_opt_rec() each for path_elements-1, getting
* appropriate tree for it and then resolving [path_elements]. */ * appropriate tree for it and then resolving [path_elements]. */
if ((sep = strrchr((const char *)name, '.'))) { if ((sep = strrchr(name, '.'))) {
*sep = '\0'; *sep = '\0';
tree = get_opt_rec(tree, name); tree = get_opt_rec(tree, name);

View File

@ -370,7 +370,7 @@ set_cookie(struct uri *uri, char *str)
if (!path) if (!path)
return; return;
path_end = strrchr((const char *)path, '/'); path_end = strrchr(path, '/');
if (path_end) if (path_end)
path_end[0] = '\0'; path_end[0] = '\0';
break; break;

View File

@ -606,7 +606,7 @@ html_embed(struct html_context *html_context, char *a,
/* If there is no extension we want to get the default mime/type /* If there is no extension we want to get the default mime/type
* anyway? */ * anyway? */
extension = strrchr((const char *)object_src, '.'); extension = strrchr(object_src, '.');
if (!extension) extension = object_src; if (!extension) extension = object_src;
type = get_extension_content_type(extension); type = get_extension_content_type(extension);

View File

@ -535,7 +535,7 @@ ecmascript_set_action(char **action, char *string)
done_uri(uri); done_uri(uri);
mem_free(string); mem_free(string);
} else { /* relative uri */ } else { /* relative uri */
char *last_slash = strrchr((const char *)*action, '/'); char *last_slash = strrchr(*action, '/');
char *new_action; char *new_action;
if (last_slash) *(last_slash + 1) = '\0'; if (last_slash) *(last_slash + 1) = '\0';

View File

@ -216,7 +216,7 @@ _nl_free_domain_conv(struct loaded_domain *domain)
static struct string * static struct string *
add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file) add_filename_to_string(struct string *str, struct loaded_l10nfile *domain_file)
{ {
char *slash = strrchr((const char *)program.path, '/'); char *slash = strrchr(program.path, '/');
size_t dirnamelen = (slash ? slash - program.path + 1 : 0); size_t dirnamelen = (slash ? slash - program.path + 1 : 0);
/* Check if elinks is being run from the source tree. */ /* Check if elinks is being run from the source tree. */

View File

@ -189,7 +189,7 @@ get_dyn_full_version(struct terminal *term, int more)
if (!more) { if (!more) {
int start_at = 0; int start_at = 0;
char *last_newline = strrchr((const char *)string.source, '\n'); char *last_newline = strrchr(string.source, '\n');
if (last_newline) { if (last_newline) {
start_at = last_newline - string.source + 1; start_at = last_newline - string.source + 1;

View File

@ -104,7 +104,7 @@ static inline char *
check_extension_type(char *extension) check_extension_type(char *extension)
{ {
/* Trim the extension so only last .<extension> is used. */ /* Trim the extension so only last .<extension> is used. */
char *trimmed = strrchr((const char *)extension, '.'); char *trimmed = strrchr(extension, '.');
struct mime_handler *handler; struct mime_handler *handler;
char *content_type; char *content_type;
@ -133,7 +133,7 @@ check_encoding_type(char *extension)
{ {
enum stream_encoding encoding = guess_encoding(extension); enum stream_encoding encoding = guess_encoding(extension);
const char *const *extension_list; const char *const *extension_list;
char *last_extension = strrchr((const char *)extension, '.'); char *last_extension = strrchr(extension, '.');
if (encoding == ENCODING_NONE || !last_extension) if (encoding == ENCODING_NONE || !last_extension)
return NULL; return NULL;

View File

@ -906,9 +906,9 @@ win32_strerror(int err)
} }
/* strip trailing '\r\n' or '\n'. */ /* strip trailing '\r\n' or '\n'. */
if ((p = strrchr((const char *)buf,'\n')) != NULL && (p - buf) >= 2) if ((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
*p = '\0'; *p = '\0';
if ((p = strrchr((const char *)buf,'\r')) != NULL && (p - buf) >= 1) if ((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
*p = '\0'; *p = '\0';
return buf; return buf;

View File

@ -347,7 +347,7 @@ execute_cgi(struct connection *conn)
return 1; return 1;
} }
last_slash = strrchr((const char *)script, '/'); last_slash = strrchr(script, '/');
if (last_slash++) { if (last_slash++) {
unsigned char storage; unsigned char storage;
int res; int res;

View File

@ -1029,7 +1029,7 @@ encode_multipart(struct session *ses, LIST_OF(struct submitted_value) *l,
add_char_to_string(data, '"'); add_char_to_string(data, '"');
/* Add a Content-Type header if the type is configured */ /* Add a Content-Type header if the type is configured */
extension = strrchr((const char *)sv->value, '.'); extension = strrchr(sv->value, '.');
if (extension) { if (extension) {
char *type = get_extension_content_type(extension); char *type = get_extension_content_type(extension);