diff --git a/src/config/options.c b/src/config/options.c index 329e9966..0b5054a6 100644 --- a/src/config/options.c +++ b/src/config/options.c @@ -477,7 +477,7 @@ init_option_listbox_item(struct option *option) struct option * add_opt(struct option *tree, unsigned char *path, unsigned char *capt, 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)); @@ -505,17 +505,17 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt, mem_free(option); return NULL; } - option->value.tree = value; + option->value.tree = (struct list_head *) value; break; case OPT_STRING: if (!value) { mem_free(option); return NULL; } - option->value.string = value; + option->value.string = (unsigned char *) value; break; case OPT_ALIAS: - option->value.string = value; + option->value.string = (unsigned char *) value; break; case OPT_BOOL: case OPT_INT: @@ -526,11 +526,11 @@ add_opt(struct option *tree, unsigned char *path, unsigned char *capt, option->value.big_number = (long) value; /* FIXME: cast from void * */ break; case OPT_COLOR: - decode_color(value, strlen((unsigned char *) value), + decode_color((unsigned char *) value, strlen((unsigned char *) value), &option->value.color); break; case OPT_COMMAND: - option->value.command = value; + option->value.command = (void *) value; break; case OPT_LANGUAGE: break; diff --git a/src/config/options.h b/src/config/options.h index 6fd70982..49eaa2f9 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -253,7 +253,7 @@ extern union option_value *get_opt_(struct option *, unsigned char *); extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, 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. * It may of some use for people wanting a very small static non-i18n elinks binary, @@ -266,38 +266,38 @@ extern struct option *add_opt(struct option *, unsigned char *, unsigned char *, #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) \ - 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) \ - 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) \ do { \ unsigned char *ptr = mem_alloc(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) #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) \ - 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) \ - 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) \ - 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) \ - 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) \ - 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 */ diff --git a/src/osdep/types.h b/src/osdep/types.h index beb91f13..2404ac01 100644 --- a/src/osdep/types.h +++ b/src/osdep/types.h @@ -140,6 +140,12 @@ typedef unsigned long long uint32_t; #define __SHRT_MAX__ 0x7fff #endif +/* + * long l; (long) (longptr_T) l == l + * void *p; (void *) (longptr_T) p == p + */ +typedef long longptr_T; + /* Define internal off_t format macro for printing variables. */ #if HAVE_OFF_T == 1 && SIZEOF_OFF_T == 8 #define OFF_T_FORMAT "lld"