mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
LONG/INT: fix compilation under AMD64, reported by Miciah.
This commit is contained in:
parent
c2ca89cab1
commit
1ec1dc43be
@ -449,7 +449,7 @@ init_option_listbox_item(struct option *option)
|
|||||||
struct option *
|
struct option *
|
||||||
add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
|
add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
|
||||||
unsigned char *name, enum option_flags flags, enum option_type type,
|
unsigned char *name, enum option_flags flags, enum option_type type,
|
||||||
long min, long max, void *value, unsigned char *desc)
|
long min, long max, longptr_T value, unsigned char *desc)
|
||||||
{
|
{
|
||||||
struct option *option = mem_calloc(1, sizeof(*option));
|
struct option *option = mem_calloc(1, sizeof(*option));
|
||||||
|
|
||||||
@ -477,17 +477,17 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
|
|||||||
mem_free(option);
|
mem_free(option);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
option->value.tree = value;
|
option->value.tree = (struct list_head *) value;
|
||||||
break;
|
break;
|
||||||
case OPT_STRING:
|
case OPT_STRING:
|
||||||
if (!value) {
|
if (!value) {
|
||||||
mem_free(option);
|
mem_free(option);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
option->value.string = value;
|
option->value.string = (unsigned char *) value;
|
||||||
break;
|
break;
|
||||||
case OPT_ALIAS:
|
case OPT_ALIAS:
|
||||||
option->value.string = value;
|
option->value.string = (unsigned char *) value;
|
||||||
break;
|
break;
|
||||||
case OPT_BOOL:
|
case OPT_BOOL:
|
||||||
case OPT_INT:
|
case OPT_INT:
|
||||||
@ -498,11 +498,11 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt,
|
|||||||
option->value.big_number = (long) value; /* FIXME: cast from void * */
|
option->value.big_number = (long) value; /* FIXME: cast from void * */
|
||||||
break;
|
break;
|
||||||
case OPT_COLOR:
|
case OPT_COLOR:
|
||||||
decode_color(value, strlen((unsigned char *) value),
|
decode_color((unsigned char *) value, strlen((unsigned char *) value),
|
||||||
&option->value.color);
|
&option->value.color);
|
||||||
break;
|
break;
|
||||||
case OPT_COMMAND:
|
case OPT_COMMAND:
|
||||||
option->value.command = value;
|
option->value.command = (void *) value;
|
||||||
break;
|
break;
|
||||||
case OPT_LANGUAGE:
|
case OPT_LANGUAGE:
|
||||||
break;
|
break;
|
||||||
|
@ -233,7 +233,7 @@ extern union option_value *get_opt_(struct option *, unsigned char *);
|
|||||||
|
|
||||||
extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
|
extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
|
||||||
unsigned char *, enum option_flags, enum option_type,
|
unsigned char *, enum option_flags, enum option_type,
|
||||||
long, long, void *, unsigned char *);
|
long, long, longptr_T, unsigned char *);
|
||||||
|
|
||||||
/* Hack which permit to disable option descriptions, to reduce elinks binary size.
|
/* Hack which permit to disable option descriptions, to reduce elinks binary size.
|
||||||
* It may of some use for people wanting a very small static non-i18n elinks binary,
|
* It may of some use for people wanting a very small static non-i18n elinks binary,
|
||||||
@ -246,38 +246,38 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
|
|||||||
|
|
||||||
|
|
||||||
#define add_opt_bool_tree(tree, path, capt, name, flags, def, desc) \
|
#define add_opt_bool_tree(tree, path, capt, name, flags, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_BOOL, 0, 1, (void *) def, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_BOOL, 0, 1, (longptr_T) def, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_int_tree(tree, path, capt, name, flags, min, max, def, desc) \
|
#define add_opt_int_tree(tree, path, capt, name, flags, min, max, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_INT, min, max, (void *) def, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_INT, min, max, (longptr_T) def, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_long_tree(tree, path, capt, name, flags, min, max, def, desc) \
|
#define add_opt_long_tree(tree, path, capt, name, flags, min, max, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_LONG, min, max, (void *) def, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_LONG, min, max, (longptr_T) def, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \
|
#define add_opt_str_tree(tree, path, capt, name, flags, def, desc) \
|
||||||
do { \
|
do { \
|
||||||
unsigned char *ptr = mem_alloc(MAX_STR_LEN); \
|
unsigned char *ptr = mem_alloc(MAX_STR_LEN); \
|
||||||
safe_strncpy(ptr, def, MAX_STR_LEN); \
|
safe_strncpy(ptr, def, MAX_STR_LEN); \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, ptr, DESC(desc)); \
|
add_opt(tree, path, capt, name, flags, OPT_STRING, 0, MAX_STR_LEN, (longptr_T) ptr, DESC(desc)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define add_opt_codepage_tree(tree, path, capt, name, flags, def, desc) \
|
#define add_opt_codepage_tree(tree, path, capt, name, flags, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_CODEPAGE, 0, 0, (void *) get_cp_index(def), DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_CODEPAGE, 0, 0, (longptr_T) get_cp_index(def), DESC(desc))
|
||||||
|
|
||||||
#define add_opt_lang_tree(tree, path, capt, name, flags, desc) \
|
#define add_opt_lang_tree(tree, path, capt, name, flags, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_LANGUAGE, 0, 0, NULL, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_LANGUAGE, 0, 0, (longptr_T) 0, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_color_tree(tree, path, capt, name, flags, def, desc) \
|
#define add_opt_color_tree(tree, path, capt, name, flags, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_COLOR, 0, 0, def, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_COLOR, 0, 0, (longptr_T) def, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_command_tree(tree, path, capt, name, flags, cmd, desc) \
|
#define add_opt_command_tree(tree, path, capt, name, flags, cmd, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_COMMAND, 0, 0, cmd, DESC(desc));
|
add_opt(tree, path, capt, name, flags, OPT_COMMAND, 0, 0, (longptr_T) cmd, DESC(desc));
|
||||||
|
|
||||||
#define add_opt_alias_tree(tree, path, capt, name, flags, def, desc) \
|
#define add_opt_alias_tree(tree, path, capt, name, flags, def, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_ALIAS, 0, strlen(def), def, DESC(desc))
|
add_opt(tree, path, capt, name, flags, OPT_ALIAS, 0, strlen(def), (longptr_T) def, DESC(desc))
|
||||||
|
|
||||||
#define add_opt_tree_tree(tree, path, capt, name, flags, desc) \
|
#define add_opt_tree_tree(tree, path, capt, name, flags, desc) \
|
||||||
add_opt(tree, path, capt, name, flags, OPT_TREE, 0, 0, init_options_tree(), DESC(desc));
|
add_opt(tree, path, capt, name, flags, OPT_TREE, 0, 0, (longptr_T) init_options_tree(), DESC(desc));
|
||||||
|
|
||||||
|
|
||||||
/* Builtin options */
|
/* Builtin options */
|
||||||
|
@ -118,4 +118,10 @@ typedef unsigned long long uint32_t;
|
|||||||
#define __SHRT_MAX__ 0x7fff
|
#define __SHRT_MAX__ 0x7fff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* long l; (long) (longptr_T) l == l
|
||||||
|
* void *p; (void *) (longptr_T) p == p
|
||||||
|
*/
|
||||||
|
typedef long longptr_T;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user