1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

Cast to (const char *) in strrchr calls

This commit is contained in:
Witold Filipczyk 2016-04-20 21:03:27 +02:00
parent 2e7a7a5ca3
commit da15322705
10 changed files with 12 additions and 12 deletions

View File

@ -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 /* 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(name, '.'))) { if ((sep = strrchr((const char *)name, '.'))) {
*sep = '\0'; *sep = '\0';
tree = get_opt_rec(tree, name); tree = get_opt_rec(tree, name);

View File

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

View File

@ -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 /* If there is no extension we want to get the default mime/type
* anyway? */ * anyway? */
extension = strrchr(object_src, '.'); extension = strrchr((const char *)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

@ -283,7 +283,7 @@ ecmascript_set_action(unsigned char **action, unsigned char *string)
done_uri(uri); done_uri(uri);
mem_free(string); mem_free(string);
} else { /* relative uri */ } else { /* relative uri */
unsigned char *last_slash = strrchr(*action, '/'); unsigned char *last_slash = strrchr((const char *)*action, '/');
unsigned char *new_action; unsigned 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)
{ {
unsigned char *slash = strrchr(program.path, '/'); unsigned char *slash = strrchr((const char *)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

@ -154,7 +154,7 @@ get_dyn_full_version(struct terminal *term, int more)
if (!more) { if (!more) {
int start_at = 0; 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) { 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 unsigned char *
check_extension_type(unsigned char *extension) check_extension_type(unsigned char *extension)
{ {
/* Trim the extension so only last .<extension> is used. */ /* 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; struct mime_handler *handler;
unsigned char *content_type; unsigned char *content_type;
@ -133,7 +133,7 @@ check_encoding_type(unsigned char *extension)
{ {
enum stream_encoding encoding = guess_encoding(extension); enum stream_encoding encoding = guess_encoding(extension);
const unsigned char *const *extension_list; 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) 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(buf,'\n')) != NULL && (p - buf) >= 2) if ((p = strrchr((const char *)buf,'\n')) != NULL && (p - buf) >= 2)
*p = '\0'; *p = '\0';
if ((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1) if ((p = strrchr((const char *)buf,'\r')) != NULL && (p - buf) >= 1)
*p = '\0'; *p = '\0';
return buf; return buf;

View File

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

View File

@ -1009,7 +1009,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(sv->value, '.'); extension = strrchr((const char *)sv->value, '.');
if (extension) { if (extension) {
unsigned char *type = get_extension_content_type(extension); unsigned char *type = get_extension_content_type(extension);