mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[cast] Explicit casts for narrowing conversions
This commit is contained in:
parent
311909f49a
commit
8999a19593
@ -89,7 +89,7 @@ render_dom_document(struct cache_entry *cached, struct document *document,
|
||||
enum sgml_parser_type parser_type;
|
||||
char *string = struri(cached->uri);
|
||||
size_t length = strlen(string);
|
||||
struct dom_string uri = INIT_DOM_STRING(string, length);
|
||||
struct dom_string uri = INIT_DOM_STRING(string, (unsigned int)length);
|
||||
|
||||
convert_table = get_convert_table(head, document->options.cp,
|
||||
document->options.assume_cp,
|
||||
|
@ -206,7 +206,7 @@ process_snippets(struct ecmascript_interpreter *interpreter,
|
||||
|
||||
fragment = get_cache_fragment(cached);
|
||||
if (fragment) {
|
||||
struct string code = INIT_STRING(fragment->data, fragment->length);
|
||||
struct string code = INIT_STRING(fragment->data, (int)fragment->length);
|
||||
|
||||
ecmascript_eval(interpreter, &code, NULL);
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ parse_dom_config(char *flaglist, char separator)
|
||||
while (flaglist) {
|
||||
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);
|
||||
struct dom_string name = INIT_DOM_STRING(flaglist, (unsigned int)length);
|
||||
|
||||
flags |= get_dom_config_flag(&name);
|
||||
if (end) end++;
|
||||
|
@ -129,7 +129,7 @@ struct dom_node_search {
|
||||
};
|
||||
|
||||
#define INIT_DOM_NODE_SEARCH(key, list) \
|
||||
{ (key), -1, 0, (list)->size, }
|
||||
{ (key), -1, 0, (int)(list)->size, }
|
||||
|
||||
int
|
||||
dom_node_casecmp(struct dom_node *node1, struct dom_node *node2)
|
||||
|
@ -19,7 +19,7 @@ map_dom_scanner_string(struct dom_scanner *scanner,
|
||||
char *ident, char *end, int base_type)
|
||||
{
|
||||
const struct dom_scanner_string_mapping *mappings = scanner->info->mappings;
|
||||
struct dom_string name = INIT_DOM_STRING(ident, end - ident);
|
||||
struct dom_string name = INIT_DOM_STRING(ident, (unsigned int)(end - ident));
|
||||
|
||||
for (; is_dom_string_set(&mappings->name); mappings++) {
|
||||
if (mappings->base_type == base_type
|
||||
|
@ -427,7 +427,7 @@ enum dom_code
|
||||
parse_sgml(struct sgml_parser *parser, char *buf, size_t bufsize,
|
||||
int complete)
|
||||
{
|
||||
struct dom_string source = INIT_DOM_STRING(buf, bufsize);
|
||||
struct dom_string source = INIT_DOM_STRING(buf, (unsigned int)bufsize);
|
||||
struct dom_node *node;
|
||||
|
||||
if (complete)
|
||||
|
@ -463,7 +463,7 @@ void
|
||||
ecmascript_protocol_handler(struct session *ses, struct uri *uri)
|
||||
{
|
||||
struct document_view *doc_view = current_frame(ses);
|
||||
struct string current_url = INIT_STRING(struri(uri), strlen(struri(uri)));
|
||||
struct string current_url = INIT_STRING(struri(uri), (int)strlen(struri(uri)));
|
||||
char *redirect_url, *redirect_abs_url;
|
||||
struct uri *redirect_uri;
|
||||
|
||||
|
@ -39,9 +39,9 @@ color_distance(const struct rgb *c1, const struct rgb *c2)
|
||||
#define GREEN_COLOR_MASK 0x0000FF00
|
||||
#define BLUE_COLOR_MASK 0x000000FF
|
||||
|
||||
#define RED_COLOR(color) (((color) & RED_COLOR_MASK) >> 16)
|
||||
#define GREEN_COLOR(color) (((color) & GREEN_COLOR_MASK) >> 8)
|
||||
#define BLUE_COLOR(color) (((color) & BLUE_COLOR_MASK) >> 0)
|
||||
#define RED_COLOR(color) (unsigned char)(((color) & RED_COLOR_MASK) >> 16)
|
||||
#define GREEN_COLOR(color) (unsigned char)(((color) & GREEN_COLOR_MASK) >> 8)
|
||||
#define BLUE_COLOR(color) (unsigned char)(((color) & BLUE_COLOR_MASK) >> 0)
|
||||
|
||||
#define RED(color) (RED_COLOR(color) << 3)
|
||||
#define GREEN(color) (GREEN_COLOR(color) << 2)
|
||||
|
@ -142,7 +142,7 @@ void kbd_ctrl_c(void);
|
||||
int is_blocked(void);
|
||||
void get_terminal_name(char[MAX_TERM_LEN]);
|
||||
|
||||
#define kbd_get_key(kbd_) ((kbd_)->key)
|
||||
#define kbd_get_key(kbd_) (char)((kbd_)->key)
|
||||
#define kbd_key_is(kbd_, key) (kbd_get_key(kbd_) == (key))
|
||||
|
||||
#define kbd_get_modifier(kbd_) ((kbd_)->modifier)
|
||||
|
@ -424,7 +424,7 @@ strtolx(char *str, char **end)
|
||||
int
|
||||
month2num(const char *str)
|
||||
{
|
||||
char month[3] = { str[0]|32, str[1]|32, str[2]|32 };
|
||||
char month[3] = { (char)(str[0]|32), (char)(str[1]|32), (char)(str[2]|32) };
|
||||
|
||||
switch (month[0]) {
|
||||
case 'j': /* jan, jun, jul */
|
||||
|
@ -71,7 +71,7 @@ current_link_evhook(struct document_view *doc_view, enum script_event_hook_type
|
||||
while ((ret = strstr((const char *)ret, "return ")))
|
||||
while (*ret != ' ') *ret++ = ' ';
|
||||
{
|
||||
struct string src = INIT_STRING(evhook->src, strlen(evhook->src));
|
||||
struct string src = INIT_STRING(evhook->src, (int)strlen(evhook->src));
|
||||
/* TODO: Some even handlers return a bool. */
|
||||
if (!ecmascript_eval_boolback(doc_view->vs->ecmascript, &src))
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user