1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-12 23:10:51 +00:00

[smjs] More compilation fixes. Mainly casts. Refs #176

This commit is contained in:
Witold Filipczyk 2022-06-17 15:55:05 +02:00
parent 4790ae9981
commit 3af789e9e6
16 changed files with 108 additions and 100 deletions

View File

@ -330,7 +330,7 @@ get_keymap(keymap_id_T keymap_id)
}
static keymap_id_T
get_keymap_id(char *keymap_str)
get_keymap_id(const char *keymap_str)
{
int keymap_id;
@ -583,7 +583,7 @@ free_keymaps(struct module *xxx)
#ifdef CONFIG_SCRIPTING
static char *
bind_key_to_event(char *ckmap, const char *ckey, int event)
bind_key_to_event(const char *ckmap, const char *ckey, int event)
{
struct term_event_keyboard kbd;
action_id_T action_id;
@ -605,7 +605,7 @@ bind_key_to_event(char *ckmap, const char *ckey, int event)
}
int
bind_key_to_event_name(char *ckmap, const char *ckey,
bind_key_to_event_name(const char *ckmap, const char *ckey,
char *event_name, char **err)
{
int event_id;
@ -902,7 +902,7 @@ get_aliased_action(keymap_id_T keymap_id, char *action_str)
/* Return 0 when ok, something strange otherwise. */
int
bind_do(char *keymap_str, const char *keystroke_str,
bind_do(const char *keymap_str, const char *keystroke_str,
char *action_str, int is_system_conf)
{
keymap_id_T keymap_id;

View File

@ -200,12 +200,12 @@ action_id_T kbd_action(keymap_id_T, struct term_event *, int *);
struct keybinding *kbd_ev_lookup(keymap_id_T, struct term_event_keyboard *kbd, int *);
struct keybinding *kbd_nm_lookup(keymap_id_T, const char *);
int bind_do(char *, const char *, char *, int);
int bind_do(const char *, const char *, char *, int);
char *bind_act(char *, const char *);
void bind_config_string(struct string *);
#ifdef CONFIG_SCRIPTING
int bind_key_to_event_name(char *, const char *, char *,
int bind_key_to_event_name(const char *, const char *, char *,
char **);
#endif

View File

@ -329,7 +329,7 @@ l_bind_key(LS)
ref = luaL_ref(S, LUA_REGISTRYINDEX);
add_format_to_string(&event_name, "lua-run-func %i", ref);
event_id = bind_key_to_event_name((char *) lua_tostring(S, 1),
event_id = bind_key_to_event_name((const char *) lua_tostring(S, 1),
(const char *) lua_tostring(S, 2),
event_name.source, &err);
done_string(&event_name);

View File

@ -27,12 +27,14 @@ static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj);
static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval);
static JSClassOps action_fn_ops = {
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr, nullptr,
smjs_action_fn_finalize,
NULL,
smjs_action_fn_callback,
nullptr, // addProperty
nullptr, // deleteProperty
nullptr, // enumerate
nullptr, // newEnumerate
nullptr, // resolve
nullptr, // mayResolve
smjs_action_fn_finalize, // finalize
smjs_action_fn_callback, // call
};
static const JSClass action_fn_class = {
@ -55,7 +57,7 @@ smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj)
(JSClass *) &action_fn_class, NULL);
#endif
hop = JS_GetPrivate(obj);
hop = (struct smjs_action_fn_callback_hop *)JS_GetPrivate(obj);
mem_free_if(hop);
}
@ -81,7 +83,7 @@ smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval)
assert(JS_InstanceOf(ctx, fn_obj, (JSClass *) &action_fn_class, NULL));
if_assert_failed return false;
hop = JS_GetInstancePrivate(ctx, fn_obj,
hop = (struct smjs_action_fn_callback_hop *)JS_GetInstancePrivate(ctx, fn_obj,
(JSClass *) &action_fn_class, NULL);
if (!hop) {
args.rval().setBoolean(false);

View File

@ -21,9 +21,13 @@ static void bookmark_finalize(JSFreeOp *op, JSObject *obj);
static bool bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
static JSClassOps bookmark_ops = {
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr, nullptr, bookmark_finalize,
nullptr, // addProperty
nullptr, // deleteProperty
nullptr, // enumerate
nullptr, // newEnumerate
nullptr, // resolve
nullptr, // mayResolve
bookmark_finalize, // finalize
};
static const JSClass bookmark_class = {
@ -82,7 +86,7 @@ bookmark_finalize(JSFreeOp *op, JSObject *obj)
if_assert_failed return;
#endif
bookmark = JS_GetPrivate(obj); /* from @bookmark_class or @bookmark_folder_class */
bookmark = (struct bookmark *)JS_GetPrivate(obj); /* from @bookmark_class or @bookmark_folder_class */
if (bookmark) object_unlock(bookmark);
}
@ -169,7 +173,7 @@ bookmark_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL))
return false;
bookmark = JS_GetInstancePrivate(ctx, hobj,
bookmark = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_class, NULL);
if (!bookmark) return false;
@ -200,7 +204,7 @@ bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL))
return false;
bookmark = JS_GetInstancePrivate(ctx, hobj,
bookmark = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_class, NULL);
if (!bookmark) return false;
@ -228,7 +232,7 @@ bookmark_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL))
return false;
bookmark = JS_GetInstancePrivate(ctx, hobj,
bookmark = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_class, NULL);
if (!bookmark) return false;
@ -259,7 +263,7 @@ bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL))
return false;
bookmark = JS_GetInstancePrivate(ctx, hobj,
bookmark = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_class, NULL);
if (!bookmark) return false;
@ -287,7 +291,7 @@ bookmark_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_class, NULL))
return false;
bookmark = JS_GetInstancePrivate(ctx, hobj,
bookmark = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_class, NULL);
if (!bookmark) return false;
@ -336,7 +340,7 @@ bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &bookmark_folder_class, NULL))
return false;
folder = JS_GetInstancePrivate(ctx, hobj,
folder = (struct bookmark *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &bookmark_folder_class, NULL);
hvp.setNull();

View File

@ -18,9 +18,13 @@
static void cache_entry_finalize(JSFreeOp *op, JSObject *obj);
static JSClassOps cache_entry_ops = {
nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr, nullptr, cache_entry_finalize
nullptr, // addProperty
nullptr, // deleteProperty
nullptr, // enumerate
nullptr, // newEnumerate
nullptr, // resolve
nullptr, // mayResolve
cache_entry_finalize // finalize
};
static const JSClass cache_entry_class = {
@ -75,7 +79,7 @@ cache_entry_get_property_content(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -119,7 +123,7 @@ cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -155,7 +159,7 @@ cache_entry_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -188,7 +192,7 @@ cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -225,7 +229,7 @@ cache_entry_finalize(JSFreeOp *op, JSObject *obj)
if_assert_failed return;
#endif
cached = JS_GetPrivate(obj);
cached = (struct cache_entry *)JS_GetPrivate(obj);
if (!cached) return; /* already detached */
@ -310,7 +314,7 @@ cache_entry_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -342,7 +346,7 @@ cache_entry_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -375,7 +379,7 @@ cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */
@ -410,7 +414,7 @@ cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &cache_entry_class, NULL))
return false;
cached = JS_GetInstancePrivate(ctx, hobj,
cached = (struct cache_entry *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &cache_entry_class, NULL);
if (!cached) return false; /* already detached */

View File

@ -262,7 +262,7 @@ smjs_init_elinks_object(void)
/* If elinks.<method> is defined, call it with the given arguments,
* store the return value in rval, and return true. Else return false. */
bool
smjs_invoke_elinks_object_method(char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval)
smjs_invoke_elinks_object_method(const char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval)
{
JS::CallArgs args = CallArgsFromVp(argc, argv);

View File

@ -12,6 +12,6 @@ void smjs_init_elinks_object(void);
/* Invoke elinks.<method> with the given arguments and put the return value
* into *rval. */
bool smjs_invoke_elinks_object_method(char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval);
bool smjs_invoke_elinks_object_method(const char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval);
#endif

View File

@ -47,7 +47,7 @@ smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj)
if_assert_failed return;
#endif
history_item = JS_GetPrivate(obj);
history_item = (struct global_history_item *)JS_GetPrivate(obj);
if (history_item) object_unlock(history_item);
}
@ -91,7 +91,7 @@ smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -156,7 +156,7 @@ smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -229,7 +229,6 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
JS::Value tmp;
JS::RootedValue r_tmp(ctx, tmp);
if (!JS_IdToValue(ctx, id, &r_tmp))
goto ret_null;
@ -315,7 +314,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -341,7 +340,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -367,7 +366,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, JS::Value
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -393,7 +392,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -419,7 +418,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, JS
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);
@ -461,7 +460,7 @@ smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, JS
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &smjs_globhist_item_class, NULL))
return false;
history_item = JS_GetInstancePrivate(ctx, hobj,
history_item = (struct global_history_item *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &smjs_globhist_item_class,
NULL);

View File

@ -38,7 +38,7 @@ script_hook_url(va_list ap, void *data)
smjs_ses = ses;
args[2].setString(JS_NewStringCopyZ(smjs_ctx, *url));
if (true == smjs_invoke_elinks_object_method(data, 1, args, &r_rval)) {
if (true == smjs_invoke_elinks_object_method((const char *)data, 1, args, &r_rval)) {
if (r_rval.isBoolean()) {
if (false == (r_rval.toBoolean()))
ret = EVENT_HOOK_STATUS_LAST;

View File

@ -55,7 +55,7 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL))
return false;
data = JS_GetInstancePrivate(ctx, hobj,
data = (int *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &keymap_class, NULL);
@ -88,7 +88,7 @@ smjs_keybinding_action_callback(va_list ap, void *data)
JS::Value rval;
JS::RootedValue r_rval(smjs_ctx, rval);
struct session *ses = va_arg(ap, struct session *);
JSObject *jsobj = data;
JSObject *jsobj = (JSObject *)data;
evhook_use_params(ses);
@ -113,7 +113,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
jsid id = hid.get();
int *data;
char *keymap_str;
const char *keymap_str;
const char *keystroke_str;
/* This can be called if @obj if not itself an instance of the
@ -123,7 +123,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
return false;
}
data = JS_GetInstancePrivate(ctx, hobj,
data = (int *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &keymap_class, NULL);
/* Ugly fact: we need to get the string from the id to give to bind_do,
@ -257,7 +257,7 @@ smjs_get_keymap_hash_object(void)
JS::RootedValue r_val(smjs_ctx);
for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) {
char *keymap_str = get_keymap_name(keymap_id);
const char *keymap_str = get_keymap_name(keymap_id);
JSObject *map = smjs_get_keymap_object(keymap_id);
assert(keymap_str);

View File

@ -31,7 +31,7 @@ static void
smjs_loading_callback(struct download *download, void *data)
{
struct session *saved_smjs_ses = smjs_ses;
struct smjs_load_uri_hop *hop = data;
struct smjs_load_uri_hop *hop = (struct smjs_load_uri_hop *)data;
JS::Value args[1], rval;
JSObject *cache_entry_object;

View File

@ -100,7 +100,7 @@ smjs_location_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Hand
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &location_array_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &location_array_class, NULL);
if (!ses) return false;
@ -147,7 +147,7 @@ smjs_location_array_finalize(JSFreeOp *op, JSObject *obj)
if_assert_failed return;
#endif
ses = JS_GetPrivate(obj);
ses = (struct session *)JS_GetPrivate(obj);
if (!ses) return; /* already detached */
@ -265,7 +265,7 @@ session_get_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -288,7 +288,7 @@ session_get_property_history(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -317,7 +317,7 @@ session_get_property_loading_uri(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -347,7 +347,7 @@ session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -370,7 +370,7 @@ session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -393,7 +393,7 @@ session_get_property_search_direction(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -416,7 +416,7 @@ session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -439,7 +439,7 @@ session_get_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -466,7 +466,7 @@ session_get_property_exit_query(JSContext *ctx, unsigned int argc, JS::Value *vp
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -489,7 +489,7 @@ session_get_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -517,7 +517,7 @@ session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -543,7 +543,7 @@ session_get_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -566,7 +566,7 @@ session_get_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -589,7 +589,7 @@ session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -616,7 +616,7 @@ session_set_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -640,7 +640,7 @@ session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -663,7 +663,7 @@ session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -686,7 +686,7 @@ session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -717,7 +717,7 @@ session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -740,7 +740,7 @@ session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -773,7 +773,7 @@ session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -806,7 +806,7 @@ session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -837,7 +837,7 @@ session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *v
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -863,7 +863,7 @@ session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Val
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -890,7 +890,7 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, hobj,
ses = (struct session *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &session_class, NULL);
if (!ses) return false;
@ -908,7 +908,6 @@ session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
//JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Value val;
int bg = 0; /* open new tab in background */
struct session *ses;
JSObject *jsobj;
@ -947,7 +946,7 @@ session_finalize(JSFreeOp *op, JSObject *obj)
if_assert_failed return;
#endif
ses = JS_GetPrivate(obj);
ses = (struct session *)JS_GetPrivate(obj);
if (!ses) return; /* already detached */
@ -1037,7 +1036,7 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
ELINKS_CAST_PROP_PARAMS
JSObject *tabobj;
struct terminal *term = JS_GetPrivate(obj);
struct terminal *term = (struct terminal *)JS_GetPrivate(obj);
int index;
struct window *tab;
@ -1056,7 +1055,7 @@ session_array_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
}
if ((void *) tab == (void *) &term->windows) return false;
tabobj = smjs_get_session_object(tab->data);
tabobj = (JSObject *)smjs_get_session_object((struct session *)tab->data);
if (tabobj) {
hvp.setObject(*tabobj);
}
@ -1140,7 +1139,7 @@ smjs_session_goto_url(JSContext *ctx, unsigned int argc, JS::Value *rval)
if (!JS_InstanceOf(ctx, this_o, (JSClass *) &session_class, NULL))
return false;
ses = JS_GetInstancePrivate(ctx, this_o,
ses = (struct session *)JS_GetInstancePrivate(ctx, this_o,
(JSClass *) &session_class, NULL);
if (!ses) return false; /* detached */

View File

@ -56,7 +56,7 @@ terminal_get_property_tab(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct terminal *term;
term = JS_GetInstancePrivate(ctx, hobj,
term = (struct terminal *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &terminal_class, NULL);
if (!term) return false; /* already detached */
@ -90,7 +90,7 @@ terminal_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &terminal_class, NULL))
return false;
term = JS_GetInstancePrivate(ctx, hobj,
term = (struct terminal *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &terminal_class, NULL);
if (!term) return false; /* already detached */
@ -127,7 +127,7 @@ terminal_finalize(JSFreeOp *op, JSObject *obj)
assert(JS_InstanceOf(ctx, obj, (JSClass *) &terminal_class, NULL));
if_assert_failed return;
#endif
term = JS_GetPrivate(obj);
term = (struct terminal *)JS_GetPrivate(obj);
if (!term) return; /* already detached */

View File

@ -67,7 +67,7 @@ view_state_get_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL))
return false;
vs = JS_GetInstancePrivate(ctx, hobj,
vs = (struct view_state *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &view_state_class, NULL);
if (!vs) return false;
@ -93,7 +93,7 @@ view_state_set_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL))
return false;
vs = JS_GetInstancePrivate(ctx, hobj,
vs = (struct view_state *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &view_state_class, NULL);
if (!vs) return false;
@ -114,7 +114,7 @@ view_state_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp)
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL))
return false;
struct view_state *vs = JS_GetInstancePrivate(ctx, hobj,
struct view_state *vs = (struct view_state *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &view_state_class, NULL);
if (!vs) return false;
@ -143,7 +143,7 @@ view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid,
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL))
return false;
vs = JS_GetInstancePrivate(ctx, hobj,
vs = (struct view_state *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &view_state_class, NULL);
if (!vs) return false;
@ -186,7 +186,7 @@ view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid,
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &view_state_class, NULL))
return false;
vs = JS_GetInstancePrivate(ctx, hobj,
vs = (struct view_state *)JS_GetInstancePrivate(ctx, hobj,
(JSClass *) &view_state_class, NULL);
if (!vs) return false;
@ -223,7 +223,7 @@ view_state_finalize(JSFreeOp *op, JSObject *obj)
(JSClass *) &view_state_class, NULL);
#endif
vs = JS_GetPrivate(obj);
vs = (struct view_state *)JS_GetPrivate(obj);
if (!vs) return; /* already detached */
@ -319,7 +319,7 @@ smjs_init_view_state_interface(void)
JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object);
JS_DefineProperty(smjs_ctx, r_smjs_elinks_object, "vs", (int32_t)0,
(unsigned int)(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY), smjs_elinks_get_view_state
JS_DefineProperty(smjs_ctx, r_smjs_elinks_object, "vs", smjs_elinks_get_view_state, nullptr,
(unsigned int)(JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY)
);
}

View File

@ -232,7 +232,7 @@ would_window_receive_keypresses(const struct window *win)
assert(!list_empty(term->windows));
if_assert_failed return 0;
selected = term->windows.next;
selected = (const struct window *)term->windows.next;
if (selected->type != WINDOW_TAB) return 0;
selected = get_current_tab(term);